mysql fetch error?
Posted: Tue Apr 20, 2004 1:48 pm
Trying to view a guestbook but i keep getting this error which i am struggling to overcome hope you can help. The error is
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Group\Apache2\htdocs\shopbots\view_guest.php on line 13
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Group\Apache2\htdocs\shopbots\view_guest.php on line 13
Code: Select all
<?
//Display the top of the page for the guestbook
echo " <center><h1> Guestbook </h1></center><br>";
echo ' <a href="sign_guestbook.php"> Click here to leave us a message</a><br><br>';
echo " <b>comments from visitors </b><hr>";
//make the query
$query = "SELECT (username,email,comments) FROM users guestbook ORDER_BY user_id";
$result = @mysql_query ($query); //Run the query.
//Fetch and print all the records.
while ($row = mysql_fetch_array($result))
{
echo "<b>username:</b> $row[0]<br>email: </b>$row[1]<br>
<b>Comments:</b> $row[2]";
}
mysql_close(); // close the database connection
?>