我試圖修復它,但我只是不能看到問題出在哪裏?請有人幫助我!謝謝你這麼多警告:mysql_result()期望參數1是資源,第26行xxx.php中給出的布爾值
function user_exists($email){
$email = mysql_real_escape_string($email);
$query = mysql_query("SELECT COUNT('user_id') FROM 'users' WHERE 'email'='$email'");
return (mysql_result($query, 0) == 1) ? true:false; //this is line 26
}
?>
它可能無法幫助回答您的問題,但您應該停止使用'mysql_ *'功能。他們正在被棄用。請使用[PDO](http://php.net/manual/en/book.pdo.php)(自PHP 5.1起支持)或[mysqli](http://php.net/manual/en/book)。 mysqli.php)(自PHP 4.1起支持)。如果你不確定使用哪一個,[閱讀這篇文章](http://stackoverflow.com/questions/13569/mysqli-or-pdo-what-are-the-pros-and-cons)。 – Matt 2012-08-09 18:17:59
可能重複的[Warning:mysql_fetch_ *期望參數1是資源,布爾給定錯誤](http://stackoverflow.com/questions/11674312/warning-mysql-fetch-expects-parameter-1-to-be-resource -boolean-given-error) – DCoder 2012-08-09 18:19:18
[mysql_fetch_array()的可能的重複期望參數1是資源,布爾給出在選擇](http://stackoverflow.com/questions/2973202/mysql-fetch-array-expects-parameter- 1-to-resource-boolean-given-in-select) – 2012-08-10 17:37:31