Eroare mysql_fetch_array() expects parameter to be resource
Scris: Mie Oct 19, 2011
As vrea ca pe prima pagina sa imi apara membrii inregistrati asa ca am facut urmatorul script:
Dupa ce rulez
imi da eroarea:
index:
Cod: Selectaţi tot
<?php
include_once "homePage_randomMembers.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Description" content="" />
<meta name="Keywords" content="" />
<title>Umbrella</title>
<link href="style/main.css" rel="stylesheet" type="text/css" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
</head>
<body>
<?php print "$MemberDisplayList"; ?><br />
</body>
</html>
si homePage_randomMembers.php
Cod: Selectaţi tot
<?php
$MemberDisplayList = '<table border="0" align="center" cellpadding="3">
<tr> ';
$sql = mysql_query("SELECT id, nume FROM users WHERE rang='1'");
$sql = mysql_query("SELECT id, nume FROM users WHERE rang='1'");
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$username = $row["nume"];
$numeCut = substr($nume, 0, 10);
$check_pic = "usersimg/$nume.jpg";
if (file_exists($check_pic)) {
$user_pic = "<img src=\"members/$id/image01.jpg\" width=\"64px\" border=\"0\" />";
} else {
$user_pic = "<img src=\"usersimg/noimg.jpg\" width=\"64px\" border=\"0\" />";
}
$MemberDisplayList .= '<td><a href="profile.php?usr=' . $nume . '" title="' . $nume . '"><font size="-2">' . $numeCut . '</font></a><br />
<div style=" height:64px; overflow:hidden;"><a href="profile.php?usr=' . $nume . '" title="' . $nume . '">' . $user_pic . '</a></div></td>';
}
$MemberDisplayList .= ' </tr>
</table> ';
?>
imi da eroarea:
Linia 9 este acel whileWarning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\homePage_randomMembers.php on line 9