Hola, estoy haciendo un bucador que busca en una base de datos, cuando introduzco el texto lo busca perfectamenteme pero al presionar el boton buscar sin introducir ningun texto me sale el siguiente error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\login\prueba.php on line 27
es en la linea de <?php while ($fila=mysql_fetch_array($rst_clientes)){ ?>
aqui esta el codigo, gracias.
<body>
<form id="form1" name="form1" method="post" action="prueba.php">
<p>
<label for="busca"></label>
Busqueda por nombre</p>
<p>
<input type="text" name="busca" id="busca" />
</p>
<p>
<input type="submit" name="buscar" id="buscar" value="Buscar" />
</p>
<p>
<?php
$busca="";
$busca=$_POST['busca'];
mysql_connect("localhost","root","");
mysql_select_db("mibase");
if($busca!=""){
$rst_clientes=mysql_query("SELECT * FROM `clientes` WHERE nombre LIKE '%".$busca."%'");
}
?>
<?php while ($fila=mysql_fetch_array($rst_clientes)){ ?>
<tr>
<td width="724"><table width="721" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="12" bgcolor="#FF6600"> </td>
<td width="663" bgcolor="#FF6600"><b><font color='white'><?php echo $fila["localidad"];?></b></td>
</tr>
</table></td>
</tr>
<tr>
<td width="316"><?php echo $fila["nombre"];?></td>
</tr>
</table></td>
</tr>
<p> </p>
<?php
}
?>
</html></p>
</form>
<p>