jeffmc21
03-10-2009, 12:44 AM
When I run this code, in my web page of course, I'm getting a warning message that says:
mysql_fetch_array(): supplied argument is not a valid MySQL result resource in site root folder syntax on line 19... (and another on line 36).
Here's the relevant code, minus the database connection info, and I've highlighted lines 19 and 36.
// Query the DB and retrieve the next game information from the table
$result = mysql_query("SELECT DATE_FORMAT(game_date,'%W, %M %d') AS game_day, `game_opponent`, `game_teams`, `game_times`, `game_loc` FROM `tbl_schedule` 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>
<table style:"width:95%;">
<tr>
<td class="gamedate">'.$row["game_day"].'</td>
</tr>
<tr>
<td class="opps">'. $row["game_opponent"] .'</td><td class="teams">'.$row["game_teams"].'</td>
</tr>
<tr>
<td class="gametime">'.$row["game_time"].'</td><td class="loc">'.$row["game_loc"].'</td>
</tr>
</table>
</div>';
}
mysql_free_result($result);
?>
Anyone have any ideas as to the problem? I have the almost exact same code on a different site, with the table and database names changed of course, and it works perfectly fine.
mysql_fetch_array(): supplied argument is not a valid MySQL result resource in site root folder syntax on line 19... (and another on line 36).
Here's the relevant code, minus the database connection info, and I've highlighted lines 19 and 36.
// Query the DB and retrieve the next game information from the table
$result = mysql_query("SELECT DATE_FORMAT(game_date,'%W, %M %d') AS game_day, `game_opponent`, `game_teams`, `game_times`, `game_loc` FROM `tbl_schedule` 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>
<table style:"width:95%;">
<tr>
<td class="gamedate">'.$row["game_day"].'</td>
</tr>
<tr>
<td class="opps">'. $row["game_opponent"] .'</td><td class="teams">'.$row["game_teams"].'</td>
</tr>
<tr>
<td class="gametime">'.$row["game_time"].'</td><td class="loc">'.$row["game_loc"].'</td>
</tr>
</table>
</div>';
}
mysql_free_result($result);
?>
Anyone have any ideas as to the problem? I have the almost exact same code on a different site, with the table and database names changed of course, and it works perfectly fine.