Bienvenido: ( Identificarse | Registrarse )      
Foros de Trucos Windows
Closed TopicStart new topicStart Poll

Outline · [ Estándar ] · Lineal+

> query que devuelve ningun valor, controlar

falconhorse28
post May 12 2006, 02:16 PM
Publicado: #1


FALCON F22
*******

Grupo: Members
Mensajes: 1.142
Registrado: 24-July 04
Desde: La Paz - Bolivia
Miembro nº: 8.537



Saludos de nuevo.
Estuve haciendo algunos query's, y algunos me devuelve ningun valor, y cuando es eso, me sale un error, como puedo controlar ese error, y que devuelva un mensaje no un erro. Todo esto en php.
Saludos.


User is offlineProfile CardPM
Go to the top of the page
+Quote Post
falconhorse28
post May 12 2006, 02:21 PM
Publicado: #2


FALCON F22
*******

Grupo: Members
Mensajes: 1.142
Registrado: 24-July 04
Desde: La Paz - Bolivia
Miembro nº: 8.537



el codigo que usu es el siguiente:
<?php
$link = mysql_connect("localhost", "nobody");
mysql_select_db("mydb", $link);
$result = mysql_query("SELECT nombre, email FROM agenda", $link);
echo "<table border = '1'> \n";
echo "<tr><td>Nombre</td><td>E-Mail</td></tr> \n";
while ($row = mysql_fetch_row($result)){
echo ""<tr><td>$row[0]</td><td>$row[1]</td></tr> \n";
}
echo "</table> \n";
?>
Cuando no hay ninguna fila me duvuelve error, pero cuando hay, no hay problema, como puedo controlar eso.

Saludos


User is offlineProfile CardPM
Go to the top of the page
+Quote Post
falconhorse28
post May 13 2006, 08:39 PM
Publicado: #3


FALCON F22
*******

Grupo: Members
Mensajes: 1.142
Registrado: 24-July 04
Desde: La Paz - Bolivia
Miembro nº: 8.537



ayudenme porfavor, como puedo controlar cuando un query me devuelve bacio.
Saludos.


User is offlineProfile CardPM
Go to the top of the page
+Quote Post
falconhorse28
post May 14 2006, 01:39 AM
Publicado: #4


FALCON F22
*******

Grupo: Members
Mensajes: 1.142
Registrado: 24-July 04
Desde: La Paz - Bolivia
Miembro nº: 8.537



El error que me devuelve es:
Unable to jump to row 0 on MySQL result index 2 in ....
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
alnitak
post May 15 2006, 03:14 PM
Publicado: #5


Carpe Diem
Group Icon

Grupo: Webmaster
Mensajes: 6.398
Registrado: 28-August 03
Desde: Valencia, Venezuela
Miembro nº: 25



Emplea msql_num_rows() para comprobar que hayan registros antes de emplear mysql_fetch_row()
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
Closed TopicTopic OptionsStart new topic

Collapse

> Topicos similares

Crear un bat para borrar un valor de registro w ... ecc242 303 14 Dec 1 2008, 12:17 PM
By: ecc242
no se instala ningun programa vitiok70 121 5 Nov 9 2008, 09:28 PM
By: rioj
No se guarda ningun archivo en los archivos tem ... wilson8733 237 2 Oct 20 2008, 01:18 AM
By: wilson8733
No veo ningun puerto usb ni nada Caarlosbdn 132 1 Oct 8 2008, 08:15 PM
By: vitrox2007
EL emule no se me conecta a ningun servidor aropa2 743 1 Sep 3 2008, 04:52 AM
By: Sonic999