2

我正在尝试显示画廊字段值为 1 和 3 的故事中的记录。有人可以帮我解决这个问题吗?

$q = mysqli_query($link, "SELECT * FROM gallery WHERE gallery = 1 AND WHERE gallery = 3");
4

1 回答 1

8

我想你写:

$q = mysqli_query($link, "SELECT * FROM gallery WHERE gallery = 1 OR gallery = 3");

因为gallery = 1 AND gallery = 3 总是错误的!

或者,您可以编写:

$q = mysqli_query($link, "SELECT * FROM gallery WHERE gallery IN (1, 3)");

IN 子句与 OR 链相同

于 2013-10-16T20:08:14.390 回答