0
美好的一天,我遇到上述錯誤上述,我不能找到合適的劇本,這..但都是發生錯誤行..mysql_fetch_array()預計參數1是資源,布爾
$db = mysql_connect($mysql_server, $mysql_username, $mysql_password);
mysql_select_db($mysql_database, $db);
$sql = "SELECT password, fullname, active FROM ".$mysql_table." WHERE username = '".$_POST['username']."'";
$result = mysql_query($sql, $db) or trigger_error (mysql_error ());
if ($data = mysql_fetch_array($result))
{
if ($crypt_pass == $data['password'] && $data['active'] != 0)
{
$found = true;
$fullname = $data['fullname'];
}
else die(mysql_error());
}
mysql_close($db);
if($found == false)
{
header('Location: '.$error_page);
exit;
}
else
{
session_start();
$_SESSION['username'] = $_POST['username'];
$_SESSION['fullname'] = $fullname;
$rememberme = isset($_POST['rememberme']) ? true : false;
if ($rememberme)
{
setcookie('username', $_POST['username'], time() + 3600*24*30);
setcookie('password', $_POST['password'], time() + 3600*24*30);
}
header('Location: '.$success_page);
exit;
}
btw,這是一個登錄表單..
謝謝!
每天20次,有人問這個問題! –
[mysql_fetch_array()的可能的重複期望參數1是資源,布爾給出選擇](http://stackoverflow.com/questions/2973202/mysql-fetch-array-expects-parameter-1-to-be-resource - 布爾賜予的,在選) –