Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/01/2011, 19:06
javierojeda13
Usuario no validado
 
Fecha de Ingreso: enero-2011
Mensajes: 36
Antigüedad: 13 años, 3 meses
Puntos: 0
Exclamación urgente error mysql_num_rows() expects parameter 1 to be resource, boolean given

ayuda tengo una base de datos para un buscador y meda el siguiente error ayuda urgente por fa "Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in"


mi base de datos


<?php
require_once("conexion.php");
/*
$sql="select count(*) as cuantos from claves
where
codigo like '%".$_GET["s"]."%'
or
direccion like '%".$_GET["s"]."%'
or
nombre like '%".$_GET["s"]."%'
";
$res=mysql_query($sql,$con);
if ($reg=mysql_fetch_array($res))
{
$total=$reg["cuantos"];
}
*/
//************************************************** ******************
if (isset($_GET["pos"]))
{
$inicio=$_GET["pos"];
}else
{
$inicio=0;
}
$sql="select * from claves
where
codigo like '%".$_GET["s"]."%'
or
direccion like '%".$_GET["s"]."%'
or
nombre like '%".$_GET["s"]."%'
limit $inicio,5
";
$res=mysql_query($sql,$con);
$total = mysql_num_rows($res);
echo $total;

?>
<html>
<head>
<title>Buscador</title>
<style type="text/css">
#principal { white:800px; height:100%}
#header { width:800px; height:100px; float:left; background-color:#666666; color:#FFFFFF}
#menu {width:800px; height:25px; float:left}
.boton {width:100px; heigt:25px; float:left; background-color:#FF0000;color:#FFFFFF}
.buscador {width:300px; height:25px; float:left}
#main{width:800px; height:100%; float:left}



</style>
</head>


<body>

<div id="principal">
<div align="center" id="header">
<h1>
cabecero
</h1>
</div>
<div id="menu">

<div class="boton">
boton 1
</div>
<div class="boton">
boton 1
</div>
<div class="boton">
boton 1
</div>
<div class="boton">
boton 1
</div>
<div class="boton">
boton 1
</div>

<!--aca va el div menu-->
<div align="center" class="buscador">
<form name="buscador" method="get" action="resultados.php">
<input type="text" name="s">
<a href="javascript:void(0)" title="Buscar" onClick="document.buscador.submit();">
<img src="imagenes/buscar.png" width="24" height="24" border="0">
</a>
</form>
</div>
<!--aca va el div menu-->

</div>

<div align="center" id="main">
<table align="center" width="500">
<tr>
<td valign="top" align="center" width="500" colspan="3">
<h3>Resultado de su B&uacute;squeda</h3>
</td>
</tr>

<tr style="background:#666666; color:#FFFFFF; font-weight:bold">

<td valign="top" align="center" width="100">
C&oacute;digo
</td>
<td valign="top" align="center" width="300">
Direcci&oacute;n
</td>
<td valign="top" align="center" width="100">
Nombre
</td>
</tr>


<?php
if ($total>0)
{
while ($reg=mysql_fetch_array($res))
{


?>

<tr style="background-color:#f0f0f0">
<td valign="top" align="center" width="100">
<?php echo $reg["codigo"];?>
</td>
<td valign="top" align="center" width="300">
<?php echo $reg["direccion"];?>
</td>
<td valign="top" align="center" width="100">
<?php echo $reg["nombre"];?>
</td>
</tr>
<?php
}
}
?>

</table>
</div>



</body>
</html>