displaying the last record first
Posted: Mon Apr 19, 2004 8:32 am
I am using this to display the list of guests who has signed my guest book but the problem is the guest who signed the book most recently goes to the very bottom of the page. Here's part of the code that I wrote:
I have got a mental block really. The answer is probably very simple but right now I just can't seem to think at all hehe 
Code: Select all
<?php
$result = mysql_query('select * from guestBook ;');
$num_results = mysql_num_rows($result);
echo '<p>Number of guests found: '.$num_results.'</p>';
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
echo '<p><strong>'.($i+1).'. Name: ';
echo htmlspecialchars(stripslashes($row['name']));
echo '</strong>';
echo '<br />Location: ';
echo stripslashes($row['location']);
echo '<br />Email: ';
echo stripslashes($row['email']);
echo '<br />URL: ';
echo stripslashes($row['url']);
echo '<br />Comments: ';
echo stripslashes($row['comments']);
}
?>