Re: Ayudaaaa!!!

From: Date: Sat, 08 May 2004 17:53:14 +0000
Subject: Re: Ayudaaaa!!!
References: 1  Groups: php.general.es 
Request: Send a blank email to general-es+get-48362@lists.php.net to get a copy of this message
Hola, que tal Seguramente ya lo viste, pero estas seguro de que esta conectando bien a la BD, por que no agregas otra linea en $result para verificar si esta conectando bien. Pablo Santana wrote:
Buenas: Tengo en una pagina un enlace para editar los datos personales de un usuario registrado.Cuando pincho en el enlace me sale el siguiente mensaje: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\miweb\personal\datosperson.php on line 15 Aqui os adjunto el codigo: <? include("../verifica.php"); include("head.php"); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>PFC.Pablo Santana Bastida</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?
$id=$_SESSION['usuario_id'];    //variable de sesion registrada mediante
verifica.php $sql = "select nombre,apellidos,dni,fechaNac,sexo,usuario,pass,lineasInvest,nombreAutor from personal where id='$id' "; $result = mysql_query($sql);
$num = mysql_num_rows($result);      <<<<========== esta es la línea 15 y no
se porque me da ese fallo if ($num==0) {
   echo "No se ha encontrado ningún registro";     <<<<======== entra
siempre por este if } else if ($numberall>0) { $x=0; ?> <h3>Datos Personales</h3> <table border=0 cellspacing=0 cellpadding=10> <tr> <td><b>NOMBRE</b></td> <td><b>APELLIDOS</b></td> <td><b>DNI</b></td> <td><b>FECHANAC</b></td> <td><b>SEXO</b></td> <td><b>USUARIO</b></td> <td><b>PASS</b></td> <td><b>LINEASINVEST</b></td> <td><b>NOMBREAUTOR</b></td> </tr> <?
       while ($x<$numberall)
       {
           // Changing Background color for each alternate row
           if (($x%2)==0) { $bgcolor="#FFFFFF"; } else {
$bgcolor="#C0C0C0"; }
           // Retreiving data and putting it in local variables for each
row
           $nombre=mysql_result($resultall,$x,"nombre");
           $apellidos=mysql_result($resultall,$x,"apellidos");
           $dni=mysql_result($resultall,$x,"dni");
           $fechaNac=mysql_result($resultall,$x,"fechaNac");
           $sexo=mysql_result($resultall,$x,"sexo");
           $usuario=mysql_result($resultall,$x,"usuario");
           $pass=mysql_result($resultall,$x,"pass");
           $lineasInvest=mysql_result($resultall,$x,"lineasInvest");
           $nombreAutor=mysql_result($resultall,$x,"nombreAutor");
?>
        <tr bgcolor="<? echo $bgcolor; ?>" height=30>
           <td> <? echo $nombre; ?> </td>
           <td> <? echo $apellidos; ?> </td>
           <td> <? echo $dni; ?> </td>
           <td> <? echo $fechaNac; ?> </td>
           <td> <? echo $sexo; ?> </td>
           <td> <? echo $usuario; ?> </td>
           <td> <? echo $pass; ?> </td>
           <td> <? echo $lineasInvest; ?> </td>
           <td> <? echo $nombreAutor; ?> </td>
           <td><a href="editPersonal.php?id=<? echo $nombre;
?>">Edit</a></td>
           <td><a href="deletePersonal.php?id=<? echo $nombre;
?>">Delete</a></td>
       </tr>
<?
       $x++;
} // end while ?> </table> <? } // end if numberall > 0 ?> <? include("foot.php"); ?> </body> </html> Por favor,si alguien sabe como solucionar este error le agradeceria mucho que me lo dijera.Muchas gracias anticipdas.Un saludo


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