2012
12.12

This can be handy to create some previous/next links for different page entries.

Previous ID

SELECT * FROM foo WHERE id = (SELECT MAX(id) FROM foo WHERE id < '.$id.')

Next ID

SELECT * FROM foo WHERE id = (SELECT MIN(id) FROM foo WHERE id > '.$id.')

No Comment.

Add Your Comment