可能重複:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select錯誤MYSQL預計Paramater爲1?
有人可以幫助我。我設置了一個div,只在帳戶類型爲「已付款」的用戶登錄時才顯示。
工作正常,當「付費」用戶登錄到div顯示時,除此之外,如果用戶註銷提出這個錯誤信息,我不知道爲什麼?
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/PTB1/includes/mod_profile/mod_star_rating/mod_rating.php on line 116
CODE:
<?php
$account_type = account_type();
while ($acctype = mysql_fetch_array($account_type))
if ($acctype['account_type'] == 'paid') {
if (logged_in()) { ?>
<div class="rate-button">can rate</div><?
}
?>
這裏是我的帳戶類型功能:
function account_type() {
global $connection;
global $_SESSION;
$query = "SELECT account_type
FROM ptb_users
WHERE id = ".$_SESSION['user_id']." ";
$account_type = mysql_query($query, $connection);
confirm_query($query, $connection);
return $account_type;
}
SQL語句在哪裏? –
account_type()是什麼?另外,停止使用mysql_ *函數。 –
您可能想要提供account_type()的代碼 – datasage