I have an issue with some code. This code goes through a database of images that have relevant links that parses into an html link and image tag. Up until today it was working fine. The funny part is I haven't even been at work to change anything because I was on spring break. I'm wondering what would all of the sudden make this not work properly.
Here is the code. The error I am recieveing is:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Inetpub\wwwroot\dining\mealplans.php on line 136
The PHP code in the documnet looks like this:
<?php
// Connect to the database
mysql_connect ('localhost', '***', '**********) ;
mysql_select_db ('ads');
// Select random rows from the database
$result = mysql_query ("SELECT * FROM links ORDER BY RAND() LIMIT 1");
// For all the rows that you selected
while ($row = mysql_fetch_array($result))
{
// Display them to the screen...
echo "<a href=\"" . $row["link"] . "\" target=_blank>
<img src=\"" . $row["image"] . "\" border=0 alt=\"" . $row["text"] . "\">
</a>" ;
}
?>
Any help would be appreciated. You can message me at Emb3rX on AIM if you have a quick fix for this.