2014-09-27 94 views
-1

我獲得以下錯誤:警告:mysql_fetch_array

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in......

這裏是我的查詢:

$result = mysql_query("SELECT * FROM users WHERE username = $user' AND password = '$pass'"); 
     while($row = mysql_fetch_array($result)) 
      { 
       $expire = time()+60*60*24*30; 
       setcookie("id", $row['id'], $expire); 
       echo "Logged in. as <b>.".$row['username']."</b>"; 
      } 

回答

0

看來你是在$用戶在此左側錯過'(我將它這裏):

$result = mysql_query("SELECT * FROM users WHERE username = '$user' AND password = '$pass'"); 
相關問題