Php MySQL查询ID<;变量
嘿,我希望实现的是一个MySQL查询,它只获取ID小于当前ID的第一行。所以基本上是下一个按钮。以下是我想修改的内容:Php MySQL查询ID<;变量,php,mysql,Php,Mysql,嘿,我希望实现的是一个MySQL查询,它只获取ID小于当前ID的第一行。所以基本上是下一个按钮。以下是我想修改的内容: $next = mysql_query("select * from posts where id<'$id'"); $next=mysql\u查询(“select*from posts where idselect*from posts where id$next=mysql\u查询”(“select*from posts where idi”如果您指的是比您的$id
$next = mysql_query("select * from posts where id<'$id'");
$next=mysql\u查询(“select*from posts where idselect*from posts where id$next=mysql\u查询”(“select*from posts where idi”如果您指的是比您的$id小的最接近的想法,请使用ORDER BY id DESC
select * from posts where id<'$id' order by id desc limit 1
$next=mysql_query("SELECT * FROM posts WHERE id<'{$id}' ORDER BY id LIMIT 1");