jeffmc21
12-10-2009, 03:06 PM
I'm able to connect to the db with no problem and have had this code work before on another site (save the changes of the tbl name, etc), but now I'm getting an error that says:
mysql_fetch_array(): supplied argument is not a valid MySQL result resouce in ... on line 18 (which is the line where the while statement begins)
Any ideas as to why it's not working? I literally copied and pasted from my code on another site where it worked for me.
$result = mysql_query("SELECT DATE_FORMAT(game_date,'%W, %M %d') AS game_night, `game_img`, `game_title`, `game_loc`, `game_direct` FROM `tbl_basketball` WHERE `game_date` >= CURDATE() ORDER BY 'game_date' DESC LIMIT 1");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<div class="nextgame">
<div class="gamehead">Our Next Game:</div>
<div class="gameicon"><img src="'.$row["game_img"].'" width="124" height="58" /></div>
<div class="gamedate">'.$row["game_night"].'</div>
<div class="game">'. $row["game_title"] .'</div>
<div class="loctime"><div class="loc">'. $row["game_loc"] . '</div><div class="time">'. $row["game_time"] . '</div></div>
<div class="direct">'.$row["game_teams"].'</div>
</div>';
}
mysql_fetch_array(): supplied argument is not a valid MySQL result resouce in ... on line 18 (which is the line where the while statement begins)
Any ideas as to why it's not working? I literally copied and pasted from my code on another site where it worked for me.
$result = mysql_query("SELECT DATE_FORMAT(game_date,'%W, %M %d') AS game_night, `game_img`, `game_title`, `game_loc`, `game_direct` FROM `tbl_basketball` WHERE `game_date` >= CURDATE() ORDER BY 'game_date' DESC LIMIT 1");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<div class="nextgame">
<div class="gamehead">Our Next Game:</div>
<div class="gameicon"><img src="'.$row["game_img"].'" width="124" height="58" /></div>
<div class="gamedate">'.$row["game_night"].'</div>
<div class="game">'. $row["game_title"] .'</div>
<div class="loctime"><div class="loc">'. $row["game_loc"] . '</div><div class="time">'. $row["game_time"] . '</div></div>
<div class="direct">'.$row["game_teams"].'</div>
</div>';
}