我不知道如何解决这个问题。错误在哪里?我试图找出答案,我认为这与AND有关
$query = mysql_query ("SELECT * FROM photos ORDER BY id DESC LIMIT ".$queryStart.", 5" AND type="pic");
尝试这个:
$query = mysql_query ("SELECT * FROM photos WHERE type='pic' ORDER BY id DESC LIMIT $queryStart, 5");
问题是:
AND type="pic"
包含在字符串中,或以任何方式连接AND type="pic"
显然是为了适应一个WHERE
类,它应该在FROM
子句之后,但在ORDER
子句之前AND
连接多个WHERE
子句 - 您只有一个。the WHERE
clause must come first before ORDER
and LIMIT
$query = mysql_query ("SELECT * FROM photos WHERE type='pic' ORDER BY id DESC LIMIT ".$queryStart.", 5");