How can I obtain a field in the same row based on the ID? the current field & nbsp; ID & nbsp;, & nbsp; BODY; I have obtained the BODY of the same row according to ID = 100, echo the body, and then obtain & nbsp; id = 101 & nbsp; based on ID + 1 & nbsp; that is, & nbsp; how to obtain a field in the same row based on the ID of the row body
Now there is a field ID, BODY;
I now obtain the BODY of the same row based on ID = 100, echo the body,
Now we need to echo the code based on the id + 1, that is, the body of the row ID = 101.
How to get the body of the next id?
------ Solution --------------------
$sql = "SELECT * FROM `shops` WHERE `id` > '100' limit 1 order by id asc";
$s = $db->getLine($sql);
$shop = array(
'body' => $s['body'],
);
------ Solution --------------------
$sql = "SELECT * FROM `shops` WHERE `id` = '101'";
$s = $db->getLine($sql);
$shop = array(
'body' => $s['body'],
);
------ Solution --------------------
Input parameters.
------ Solution --------------------
If you are a big 1 user, you also need to specify the limit
$sql = "SELECT * FROM `shops` WHERE `id` > '100' limit 1 order by id ASC limit 1";
$s = $db->getLine($sql);
$shop = array(
'body' => $s['body'],
);