Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php MySQL查询ID<;变量_Php_Mysql - Fatal编程技术网

Php MySQL查询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

嘿,我希望实现的是一个MySQL查询,它只获取ID小于当前ID的第一行。所以基本上是下一个按钮。以下是我想修改的内容:

$next = mysql_query("select * from posts where id<'$id'");

$next=mysql\u查询(“select*from posts where id
select*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");