开发者社区 问答 正文

这句sql哪里出错了呀。

$sql="select * from student where studentid={$studentid} and likeclassid={$classid}";

PS:likeclassid 是一个完整的字段名

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and likeclassid=1176' at line 1

展开
收起
a123456678 2016-07-01 11:45:41 1635 分享 版权
2 条回答
写回答
取消 提交回答
  • 会不会是数据类型的原因导致的

    2019-07-17 19:49:53
    赞同 展开评论
  • 语法上应为 classid like {$classid}
    但既然是like了就要模糊匹配,取决于你想匹配的内容使用%,*。

    2019-07-17 19:49:53
    赞同 展开评论
问答标签:
问答地址: