Get previous and next row from current id

Posted by Hukr on Stack Overflow See other posts from Stack Overflow or by Hukr
Published on 2009-02-27T13:08:32Z Indexed on 2012/06/30 9:16 UTC
Read the original article Hit count: 147

Filed under:
|

How can I do to get the next row in a table?

`image_id` int(11) NOT NULL auto_increment
`image_title` varchar(255) NOT NULL
`image_text` mediumtext NOT NULL
`image_date` datetime NOT NULL
`image_filename` varchar(255) NOT NULL

If the current image is 3 for example and the next one is 7 etc. this won’t work:

$query = mysql_query("SELECT * FROM images WHERE image_id = ".intval($_GET['id']));
echo $_GET['id']+1;

How should I do?

thanks

© Stack Overflow or respective owner

Related posts about sql

Related posts about mysql