>  Q&A  >  본문

php - 这句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

高洛峰高洛峰2724일 전289

모든 응답(2)나는 대답할 것이다

  • 阿神

    阿神2017-04-10 15:25:51

    把大括号去掉 而且like后面少空格 匹配格式也不对

    회신하다
    0
  • PHP中文网

    PHP中文网2017-04-10 15:25:51

    语法上应为 classid like {$classid}
    但既然是like了就要模糊匹配,取决于你想匹配的内容使用%,*。

    회신하다
    0
  • 취소회신하다