SQL
$rs= mysql_query("select * from cxjb2 where nam ".$_POST[select3]." $_POST[nam] and cat ".$_POST[select0]." $_POST[cat] and sha ".$_POST[select1]." $_POST[sha] and pri is NULL or nam ".$_POST[select3]." $_POST[nam] and cat ".$_POST[select0]." $_POST[cat] and sha ".$_POST[select1]." $_POST[sha]"); $rs= mysql_query("(select * from cxjb2 where nam ".$_POST[select3]." $_POST[nam] and cat ".$_POST[select0]." $_POST[cat] and sha ".$_POST[select1]." $_POST[sha]) and (pri is NULL or pri is NOT NULL)");
就是
$rs= mysql_query("(...) and (...)");
你说这样对吗?
就是这样!
while($rst = mysql_fetch_row($rs)){
加了括号后此行程序报错
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in E:\apache\htdocs\chashi2.php on line 329
就是这样!???
语法都不对了,还不报错吗?
恕我眼拙
我知道语法肯定错了
只是不知道哪里错了
所有的sql指令都必须以 SQL 命令字开头
我悟了 谢谢大大的指教
$rs= mysql_query("select * from cxjb2 where (nam ".$_POST[select3]." $_POST[nam] and cat ".$_POST[select0]." $_POST[cat] and sha ".$_POST[select1]." $_POST[sha]) and (pri is NULL or pri is NOT NULL)");
我把括号位置改变后成功了。
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号