有人能帮我吗。我将 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
代码:
<?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;
}