Having trouble creating a while loop to view records in my db (guestbook)
I keep getting the following error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home2/rgevans/public_html/guestbook/guestbook-view.php on line 139
this is my code - can anyone see what ive done wrong?
----Ment2Excel (M2E)----
--LEARN BY EXAMPLE--
I keep getting the following error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home2/rgevans/public_html/guestbook/guestbook-view.php on line 139
this is my code - can anyone see what ive done wrong?
Code:
$sql = "SELECT * from m2e_guestbook order by time desc limit 3";
$rs = @mysql_query($sql);
while ($row = mysql_fetch_array($rs))
{
?>
<table border="1" width="544">
<tr>
<td><b>Name:</b> <? echo $row["name"]; ?></td>
<td><b>Email:</b>
<a href="mailto:<? echo $row["email"]; ?>">
<? echo $row ["email"]; ?></a> </td></tr>
<tr>
<td colspan="2">
<?php $datetime = $row["time"];
$year = substr ($datetime,0,4);
$mon = substr ($datetime,4,2);
$day = substr ($datetime,6,2);
$hour = substr ($datetime,8,2);
$min = substr ($datetime,10,2);
$sec = substr ($datetime,12,2);
$orgdate = date("1 F dS, Y h:i A", mktime($hour,$min,$sec,$mon,$day,$year));
?>
<strong>Date:</strong> <? echo $orgdate; ?></td>
</tr>
<tr><td colspan="2"><b>Comments:</b>
<? echo $row["comments"]; ?></td></tr>
</table>
<br>
<? } ?>
----Ment2Excel (M2E)----
--LEARN BY EXAMPLE--