Google
Web dns.bdat.net

Re: [PHP-ES] Registros

From: Pablo M. Rivas ( pmrivas01(EN)yahoo.com.ar)
Date: Fri Jun 25 2004 - 15:32:28 CEST


Hello Fernández,

$elid=10;
list($anterior)=mysql_fetch_row(mysql_query("Select id from datos where id<$elid order by id DESC limit 0,1", $db));
list($siguiente)=mysql_fetch_row(mysql_query("Select id from datos where id>$elid order by id asc limit 0,1", $db));
if (!$anterior) echo "NO HAY ANTERIOR";
   else echo "el anterior de $elid es $anterior";
if (!$siguiente) echo "NO HAY SIGUIENTE";
  else echo "el siguiente de $elid es $siguiente";

  
Salu2

FC> Gente, como les va?

FC> Alguien tendria alguna idea para tirarme de como poder tomar, a partir de una serie de registros en MySQL y un valor de id (por ej.), el valor anterior y el valor siguiente?

FC> Por ej. tengo 10 registros (1, 3, 4, 5, 7, 9, 10, 20, 31, 42) como podria, teniendo el valor 9 tomar la fila anterior (7) y la fila siguiente (10)?? La idea es hacer algo gral. y poder, ap
FC> partir de cualquier valor, tomar el anterior y siguiente.

FC> Saludos,
FC> Roberto O. Fernández Crisial
FC> robero(at)fernandezcrisial(dot)com(dot)ar

-- 
Best regards,
 Pablo 
-- 
PHP Spanish Localization Talk Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


This archive was generated by hypermail 2.1.7 : Tue Sep 21 2004 - 21:34:42 CEST