• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

mysql_query()中的sql话语好像不能带括号

php 搞代码 4年前 (2022-01-24) 16次浏览 已收录 0个评论

mysql_query()中的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)”);

同样的逻辑关系转换成此语句时便不能成功执行了。

请问各位大大指教

SQL

发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址