重複の可能性:
mysql_fetch_array()は、パラメーター1がリソースであり、ブール値がselectで指定されていることを想定しています。
私は、この質問をすることを想定していなかったことを知っています。なぜなら、それは以前に尋ねられたものであり、ここにそれに対する答えがあるからです。しかし、私はこれが同じことだとは思いません。エラーが発生した場所の行番号の説明がないのに、これまでにそのようなブールエラーに遭遇したことはありませんか?
代わりに、問題を特定するのに役立つ行情報やその他の情報がないこのエラーメッセージだけが表示されますか?
これが一語一語取得する際のエラーです:
: 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
通常は行番号を示しますが、この場合は明らかにそうではないため、奇妙です。
私はこのmysql関数を使用しています:
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;
}
そしてこのphpコード:
<?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>";
}
}
}
?>
誰かが私にこのエラーが発生する理由を教えてもらえますか?