Hello. Please look at the code below and tell me the correct code for it please. here is the message i get.."Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given"
<?php include("function.php"); ?>
<?php include("header.php"); ?>
<?php include("headscript.php"); ?>
<script type="text/javascript">
function noAcc(){
$.fallr('show', {
icon : 'error',
content : '<p>You need an account to complete offers. Don\'t you want us to track the points you earn!? <br>;)</p>'
});
};
</script>
<script type="text/javascript">
function errorMsg(msg){
$.fallr('show', {
icon : 'error',
content : msg
});
};
</script>
<div id="body">
<div class="box">
<h2>Rewards</h2>
<div style="padding:10px; border:1px solid #557453; background:url(../images/boxbg.png);">
<table align="center">
<?php
$rewards = mysql_query("SELECT * FROM rewards ORDER BY points");
$rowNum = 0;
$rowMax = 4;
while($row = mysql_fetch_array($rewards))
{
if($rowNum ==0){
echo "<tr>";
}
echo "<td style=\"border:1px solid #557453;\" align=\"center\" width=\"200px\"><h3 style=\"background:url(../images/historytop.png);\">". $row['title']."</h3><img style=\"margin:5px;\" src=\"". $row['img']."\" width=\"150\" height=\"150\" /><br /><table width=\"100%\"><tr><td valign=\"middle\"><h4 style=\"display:inline\">Points:</h4> ". $row['points']." <img src=\"images/point.png\" /></td>";
if(!isset($_SESSION["user"])){
echo"<td valign=\"middle\"><img onclick=\"errorMsg('You need an account to be able to purchase items.')\" style=\"cursor:pointer; border:0px\" src=\"/images/purchase.png\" /></td>
</tr></table></td>";
} else {
$userId = $_SESSION["user"];
$myPoints = mysql_result(mysql_query("SELECT points FROM balances WHERE userId = '$userId'"), 0);
if($myPoints <= $row['points']){
echo"<td valign=\"middle\"><img onclick=\"errorMsg('You do not have enough points to get that. You have $myPoints points.')\" style=\"cursor:pointer; border:0px\" src=\"/images/purchase.png\" /></td>
</tr></table></td>";
} else {
echo"<td valign=\"middle\"><a href=\"redeem.php?id=".$row['rewardId']."\"><img border:0px\" src=\"/images/purchase.png\" /></a></td>
</tr></table></td>";
}
}
$rowNum++;
if($rowNum >= $rowMax){
$rowNum = 0;
echo "</tr>";
}
}
?>
</table>
</div>