RE: [PHP-ES] Pregunta soble MySQL

From: Date: Tue, 09 Apr 2002 13:55:39 +0000
Subject: RE: [PHP-ES] Pregunta soble MySQL
References: 1 2 3 4 5 6  Groups: php.general.es 
Request: Send a blank email to general-es+get-21299@lists.php.net to get a copy of this message
Hola Cómo estás?? No existe una función que yo sepa que te haga eso pero lo que puedes hacer es lo siguiente - Un select sin condiciones es dedcir: select * from tabla; - Luego haces una función que reciba el "Resource #ID" que te devuelve el mysql_query - En esta función hacees un bucle buscando el ID que nececsitas con un contador dentro Mas o menos asi En el programa: $sql="select * from tabla"; $resultado=mysql_query($sql); echo $cuenta_filas($resultado,$Id_a_buscar); En la funcion aparte function cuenta_filas($resultado,$id) { $numero=mysql_num_rows($resultado); for ($i=1;$i<=$numero;$i++) { $fila=mysql_fetch_array($resultado); if ($id==$fila['ID']) return $i; // Devuelve la posición } return 0; // Devuelve 0 si no encuentra. } Espero te sirva Hermann > > > > > > > > > > _________________________________________________________ > > Do You Yahoo!? > > Get your free @yahoo.com address at http://mail.yahoo.com > > > > > > --------------------------------------------------------------------- > > Archivo On-line: http://www.phpes.com/ > > via news: news://news.phpes.com/ > > Manual PHP en español: http://www.php.net/manual/es/ > > Para dar de baja la suscripción, mande un mensaje a: > > lista-unsubscribe@phpes.com > > > --------------------------------------------------------------------- > Archivo On-line: http://www.phpes.com/ > via news: news://news.phpes.com/ > Manual PHP en español: http://www.php.net/manual/es/ > Para dar de baja la suscripción, mande un mensaje a: > lista-unsubscribe@phpes.com >

« previous php.general.es (#21299) next »