Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select
Can someone help me. I'm setting a div to show only when users with account type 'paid' is logged in.
It works fine, when 'paid' users are logged in the div shows, but otherwise if the user's are logged out it comes up with this error message and i don't know why?
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><?
}
?>
Here is my account type function:
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;
}