Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/07/2008, 10:54
congas1983
 
Fecha de Ingreso: septiembre-2007
Mensajes: 47
Antigüedad: 16 años, 7 meses
Puntos: 0
error en consulta

amigos

tengo un problema para generar una consulta
tengo una pagina donde seleccion un combo para realizar una consulta y en un caudro de texto digito lo que voy a buscar, cuando envio el formulario para que me haga la consulta me sale este error

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:Archivos de programaxampphtdocsSICEconsultamultiple.php on line 38
El registro no existe

ESTE ES EL CODIGO DE LA CONSULTA


<html>

<head>
<title></title>
<style>
<!--.blur {filter: blur (add = 8, direction = 245, strenght = 24); height: 40} -->
</style>
</head>

<body bgcolor = "#019833">
<center><font size = "5" color = "blue" face = "arial black" class = "blur">
<?php
include ("conexion.php");
$opc = $cbocampo;
switch($opc)
{
case 1:
$consulta = "select * from datos where identificador = '$txtvalor'";
break;
case 2:
$consulta = "select * from datos where nombre like '%$txtvalor%'";
break;
case 3:
$consulta = "select * from datos where telefonocasa = '$txtvalor'";
break;
case 4:
$consulta = "select * from datos where telefonoof = '$txtvalor'";
break;
case 5:
$consulta = "select * from datos where email like '%$txtvalor%'";
break;
case 6:
$consulta = "select * from datos where direccion like '$txtvalor'";
break;
}
$resultado = mysql_query($consulta);
$numreg = mysql_num_rows($resultado);
if ($numreg == 0)
{
echo "El registro no existe";
}
else
{
?>
</font></center>
<font size = "2" color = "white" face = "arial black">
<table border = "1" align="center" bordercolor = "blue">
<tr>
<th><font face = "arial black"> Identificador </font></th>
<th><font face = "arial black"> Nombre </font></th>
<th><font face = "arial black"> Telefono casa </font></th>
<th><font face = "arial black"> Telefono oficina </font></th>
<th><font face = "arial black"> E-mail </font></th>
<th><font face = "arial black"> Dirección </font></th>
<?
while($filas = mysql_fetch_array($resultado))
{
?>
<tr>
<td><font color = "white" face = "arial black"><? echo $filas["identificador"]; ?></font></td>
<td><font color = "white" face = "arial black"><? echo $filas ["nombre"]; ?></font></td>
<td><font color = "white" face = "arial black"><? echo $filas ["telefonocasa"]; ?></font></td>
<td><font color = "white" face = "arial black"><? echo $filas ["telefonoof"] ?> </font></td>
<td><font color = "white" face = "arial black"><? echo $filas ["email"] ?> </font></td>
<td><font color = "white" face = "arial black"><? echo $filas ["direccion"]; ?></font></td>
</tr>
<?
} //mq
} //else
?>
</table>
</font>
</body>
</html>