Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select
i know were not suppose to ask this question because its been asked before and theres an aswer to it on here. but i dont think this is the same thing. i've never come across a boolean error like that before with out it giving a description of the line number of where the error is?
Instead all im getting is this error message without any line information or other information to help me identify the problem?
here's the errors im getting word for word:
: mysql_fetch_array() expects parameter 1 to be resource, boolean given in on line : mysql_fetch_array() expects parameter 1 to be resource, boolean given in on line
It's strange because it normally tells the line number but clearly not in this case.
I am using this mysql function:
function account_perms() {
global $connection;
global $_SESSION;
global $profile_id;
$query = "SELECT *
FROM ptb_permissions
WHERE ptb_permissions.private_id = \"$profile_id\"
AND ptb_permissions.user_id = ".$_SESSION['user_id']." ";
$account_perms = mysql_query($query, $connection);
confirm_query($query, $connection);
return $account_perms;
}
and this php code:
<?php
$account_perms = account_perms();
while ($perms = mysql_fetch_array($account_perms)) {
if ($perms['privellages'] == '1') {
$photo = "data/private_photos/$profile[1]/pic1.jpg";
if (!file_exists($photo)) {
$photo = "data/photos/0/_default.jpg";
}
$thumb = "data/private_photos/$profile[1]/thumb_pic1.jpg";
if (!file_exists($thumb)) {
$thumb = "data/photos/0/_default.jpg";
}
if (logged_in()) {
echo "<li><a href=\"$photo\" rel=\"shadowbox\" title=\"<strong>$profile[2]'s Photo's</strong>\"><img src=\"$thumb\" width=\"90\" height=\"90\" alt=\"<strong>{$profile[2]}'s Photos</strong>\" /></a></li>";
}
}
}
$account_perms = account_perms();
while ($perms = mysql_fetch_array($account_perms)) {
if ($perms['privellages'] == '0') {
$photo = "data/private_photos/0/_default.jpg";
if (!file_exists($photo)) {
$photo = "data/photos/0/_default.jpg";
}
$thumb = "data/private_photos/0/_default.jpg";
if (!file_exists($thumb)) {
$thumb = "data/photos/0/_default.jpg";
}
if (logged_in()) {
echo "<li><a href=\"$photo\" rel=\"shadowbox\" title=\"<strong>$profile[2]'s Photo's</strong>\"><img src=\"$thumb\" width=\"90\" height=\"90\" alt=\"<strong>{$profile[2]}'s Photos</strong>\" /></a></li>";
}
}
}
?>
please can someone advise me why im getting this error.