Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/11/2006, 15:15
Avatar de franklin85
franklin85
 
Fecha de Ingreso: octubre-2006
Mensajes: 103
Antigüedad: 17 años, 6 meses
Puntos: 0
problemas con mysql_fetch_array

tengo este problema en el archivo buscar.php coloco el sgte codigo

Código PHP:
<form method="post"  action="buscar2.php">
<
select name="metode" size="1">
<
option value="row_nombre">nombre</option>
<
option value="row_apellido">apellido</option>
</
select>
<
input type="text" name="search" size="25">
<
input type="submit" value="Buscar">
</
form
y en el archivo buscar2.php coloco lo sgte

Código PHP:
<?
$hostname 
"localhost";         // Usually localhost.
$username "aaaaa";     // If you have no username, leave this space empty.
$password "eeee";         // The same applies here.
$usertable "prueba";         // This is the table you made.
$dbName "xxxxxxx";         // This is the main database you connect to.

MYSQL_CONNECT($hostname$username$password) OR DIE("Unable to connect to database");
@
mysql_select_db"$dbName") or die( "Unable to select database");
?>
<?
//error message (not found message)
$XX "No Record Found";

$result mysql_query("SELECT * FROM prueba WHERE $metode LIKE '%$search%' LIMIT 0, 30 ");
while (
$row  =  mysql_fetch_row($result))
   {
        
$nombre=$row["row_nombre"];
        
$apellido=$row["row_apellido"];
        
$dni=$row["row_dni"];

print (
"this is for $id, and this print the nombre end so on...");
   }

//below this is the function for no record!!
if (!$nombre)
{
print (
"$XX");
}
//end
?>
cuando doy click en el boton en buscar me bota el sgte error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in buscar2.php on line 16.
Si alguien tiene la solución le agradeceria en que me haga saber, gracias.