$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)");同样的逻辑关系转换成此语句时便不能成功执行了。请问各位大大指教
SQL
SQL
就是
$rs= mysql_query("(...) and (...)");
你说这样对吗?
加了括号后此行程序报错Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in E:\apache\htdocs\chashi2.php on line 329
我把括号位置改变后成功了。