我正试图从图库字段值为1和3的故事中显示记录。 任何人都可以帮我解决这个问题吗?
$q = mysqli_query($link, "SELECT * FROM gallery WHERE gallery = 1 AND WHERE gallery = 3");
答案 0 :(得分:8)
我想你写道:
$q = mysqli_query($link, "SELECT * FROM gallery WHERE gallery = 1 OR gallery = 3");
因为gallery = 1 AND gallery = 3总是FALSE!
或者你可以写:
$q = mysqli_query($link, "SELECT * FROM gallery WHERE gallery IN (1, 3)");
IN子句与OR链相同