Obtenha os links seguintes e anteriores com MySQL e PHP

Código simples para adicionar links próximos e anteriores para navegar entre os registros.

$navquery= "SELECT(
SELECT id FROM table

WHERE id < '"
.$current_id."' ORDER BY id DESC LIMIT 1
) AS previd, (

SELECT id FROM table

WHERE id > '"
.$current_id."' ORDER BY id ASC LIMIT 1
) AS nextid"
;

$navresult
= mysql_query($navquery);
$navrow
= mysql_fetch_array($navresult);
$previd
= $navrow['previd'];
$nextid
= $navrow['nextid'];

echo
"Previous ID = ".$previd." - Next ID = ".$nextid;