Guestbook Entry Order
Posted: Sun Jan 04, 2004 10:54 am
Hey 
I've made a simple guestbook, with learning scripts from around the net
Heres the index.php which displays the title of all entries that are added. By default it displays the oldest at the top, but how would i make it display the newest entry at the top of the page?
Heres the index.php code:
My coding isnt up to standards, its very messy and i dont have any comments in there at the moment, if you want to modify it for me by sticking comment blocks in then i'd be grateful 
I've made a simple guestbook, with learning scripts from around the net
Heres the index.php code:
Code: Select all
<?php include("header.php"); ?>
<tr valign="top">
<td width="45%" align="left"><font face="Verdana" size="1">Title</font></td>
<td width="35%" align="right"><font face="Verdana" size="1">Author</font></td>
<td width="20%" align="right"><font face="Verdana" size="1">Date Entered</font></td>
</tr>
<?
mysql_pconnect("localhost","dale","***");
mysql_select_db("dale");
$result = mysql_query("select * from guestbook");
while($r=mysql_fetch_array($result))
{
$id=$r["id"];
$title=$r["title"];
$msg=$r["msg"];
$author=$r["author"];
$email=$r["email"];
$date=$r["date"];
echo "<tr valign="top">
<td width="45%" align="left"><font face="Verdana" size="1"><a href="./view.php?id=$id">$title</a></font></td>
<td width="35%" align="right"><font face="Verdana" size="1"><a href="mailto:$email">$author</a></font></td>
<td width="20%" align="right"><font face="Verdana" size="1">$date</font></td>
</tr>";
}
?>
<?php include("footer.php"); ?>