Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/01/2007, 20:01
Avatar de kalixe985
kalixe985
 
Fecha de Ingreso: junio-2006
Ubicación: Colombiano viviendo en Es
Mensajes: 73
Antigüedad: 17 años, 10 meses
Puntos: 0
De acuerdo ayuda con warning al ejecutar un buscador en php

HOla!!
Estoy haciendo una mínima web para una práctica, pero al querer ponerle un buscador, me sale siempre el siguiente error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C: \Servidor\WEB\buscador.php on line 13
¡ No se ha encontrado ningún registro !


Mi código php es el siguiente, está en el archivo buscador.php:

Código PHP:
<html> 
<body> 
  
<?php 
if (isset($buscar)){ 
      echo 
"Debe especificar una cadena a buscar"
      echo 
"</html></body> \n"
      exit; 
}
$link mysql_connect("localhost""kalixe985","garzimba985"); 
mysql_select_db("mydb"$link); 
$result mysql_query("SELECT * FROM agenda WHERE nombre LIKE '%$buscar%' ORDER BY nombre"$link); 
if (
$row mysql_fetch_array($result)){ 
      echo 
"<table border = '1'> \n"
//Mostramos los nombres de las tablas 
echo "<tr> \n"
while (
$field mysql_fetch_field($result)){ 
            echo 
"<td>$field->name</td> \n"

      echo 
"</tr> \n"
do { 
            echo 
"<tr> \n"
            echo 
"<td>".$row["id"]."</td> \n"
            echo 
"<td>".$row["nombre"]."</td> \n"
            echo 
"<td>".$row["direccion"]."</td> \n"
            echo 
"<td>".$row["telefono"]."</td> \n"
            echo 
"<td><a href='mailto:".$row["email"]."'>".$row["email"]."</a></td> \n"
            echo 
"</tr> \n"
      } while (
$row mysql_fetch_array($result)); 
            echo 
"</table> \n"
} else { 
echo 
"¡ No se ha encontrado ningún registro !"

?> 
  
</body> 
</html>
Y el html es:
Código HTML:
<html> 
<body> 
<form method="POST" action="http ://localhost/buscador.php"> 
<strong>Palabra clave:</strong> <input type="text" name="T1" size="20"><br><br> 
<input type="submit" value="Buscar" name="$buscar"> 
</form> 
</body> 
</html> 
A ver si alguien me puede ayudar....Muchas gracias de antemano!!!!