Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/08/2012, 17:59
Avatar de kendall00
kendall00
 
Fecha de Ingreso: septiembre-2011
Ubicación: $Ubicacion => ['Costa Rica'];
Mensajes: 85
Antigüedad: 12 años, 7 meses
Puntos: 5
Error en consulta MySQL

Hola, cuando ejecuto este script:
Código PHP:
Ver original
  1. mysql_connect($host,$user,$pass) or die (header ("Location index.php?error=x001"));
  2. mysql_select_db($database) or die (header ("Location index.php?error=x002"));
  3.     if ($v1 = "" || $v2 = ""){
  4.         header ("Location index.php?error=x003");
  5.     }else{
  6.         $result = mysql_query('SELECT usuario, contraseña, id FROM usuarios WHERE usuario=\''.$usuario.'\'');
  7.          if($row = mysql_fetch_array($result)){
  8.             if($row["contraseña"] == $password){
  9.                 $_SESSION["usuario"] = $row['usuario'];
  10.                 $_SESSION["activo"] = "si";
  11.                 $_SESSION["id"] = $row['id'];
  12.                 header ("Location home.php");
  13.         }
  14.         else
  15.         {
  16.             header ("Location index.php?error=x004");
  17.         }
  18.             }else{
  19.             header ("Location index.php?error=x005");
  20.     }
  21.        
  22.     }
me da este error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a5158418/public_html/login.php on line 34
La linea 34 es:
if($row = mysql_fetch_array($result)){

¿Qué hice mal?
__________________
El limite es la imaginacion... con Dios todo es posible.