Jump to content

mysql_fetch_array() expects parameter 1 to be resource, boolean given


Recommended Posts

ok so im new to this forum and new to posting in forums altogether so if i dont do this right please let me know what im doing wrong so i can correct myself.

 

so i am having a few problems with my code and really strugleing to get it going right.

the first issue i am having is stated in the title of this post:

mysql_fetch_array() expects parameter 1 to be resource, boolean given

i would be very greatful if i could get help with these issues, there are four of them

but im sure all four are simple. ill try to tackle them one at a time though.

 

$MemberDisplayList = '<table border="0" align="center" cellpadding="6">
              <tr>  ';
// Mysql connection is already made in the file this one gets included into
// So we can run queries here without having to connect again
$sql = mysql_query("SELECT id, username, firstname FROM myMembers Where email_activated='1' ORDER BY RAND() LIMIT 9");
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$username = $row["username"];
$firstname = $row["firstname"];
if (!$firstname) {
	$firstname = $username;
}
    $firstnameCut = substr($firstname, 0, 10);
$check_pic = "members/$id/image01.jpg";
if (file_exists($check_pic)) {
    $user_pic = "<img src=\"members/$id/image01.jpg\" width=\"64px\" border=\"0\" />";
} else {
	$user_pic = "<img src=\"members/0/image01.jpg\" width=\"64px\" border=\"0\" />";
}
$MemberDisplayList .= '<td><a href="profile.php?id=' . $id . '" title="' . $firstname . '"><font size="-2">' . $firstnameCut . '</font></a><br />
<div style=" height:64px; overflow:hidden;"><a href="profile.php?id=' . $id . '"  title="' . $firstname . '">' . $user_pic . '</a></div></td>';

} // close while loop

$MemberDisplayList .= '              </tr>
            </table>  ';
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.