Ver Mensaje Individual
  #10 (permalink)  
Antiguo 10/04/2011, 01:59
Avatar de masterpuppet
masterpuppet
Software Craftsman
 
Fecha de Ingreso: enero-2008
Ubicación: Montevideo, Uruguay
Mensajes: 3.550
Antigüedad: 16 años, 3 meses
Puntos: 845
Respuesta: Paginar Siguiente-Anterior con PHP

Que tal VbOkonly,

Si el id es autoincrement, la solución es bastante simple, se suele hacer utilizando <>, limit y el id actual, los select's serian algo así:

Código PHP:
Ver original
  1. $prev = "SELECT id FROM fotos WHERE id < $current ORDER BY id DESC LIMIT 1" ;

Código PHP:
Ver original
  1. $next = "SELECT id FROM fotos WHERE id > $current ORDER BY ID ASC LIMIT 1";

$current seria el id actual.

Saludos.
__________________
http://es.phptherightway.com/
thats us riders :)