PHP Guestbook: change entry order

Hi,

I have a PHP guestbook intergrated into my flash movie, but when new entries are added they go to the bottom - I would like the newest entry to always be at the top. Can anyone please help?

Here is the PHP code:

<?

if (!isset($name) || !isset($email) || !isset($message) || empty($name) || empty($email) || empty($message)) {
print “&result=Fail”;
print “&errorMsg=” . urlencode(“Input required for all fields.”);
exit;
}

$email = strtolower($email);

addentry($name, $email, $message);

function addentry($name, $email, $message) {

$posted = strftime("%D %I:%M %p");

$message = stripslashes($message);

$file = fopen(‘entry.txt’, ‘a+’);

if (!$file) {
print “&result=Fail”;
print “&errorMsg=” . urlencode(“Could not open entry.txt file. Change CHMOD levels to 766.”);
exit;
}

fputs($file, “<font color=”#ffffff">Name:</font> $name
<font color="#ffffff">Email:</font><font color="#ffffff"><A href=“mailto:$email”> $email</A></font><br>
<font color="#ffffff">Posted:</font> $posted
<font color="#ffffff">Message:</font> $message

");
fclose($file);

// Send admin an email when new entry occurs
mailAdmin($name, $email, $message);
}

function mailAdmin($name, $email, $message) {
$mailTo = "[email protected]";
$mailFrom = “From: <[email protected]>”;
$mailSubject = “New Guestbook Entry”;
$mailBody = "A visitor to your site has left the following information in your guestbook:

Name: $name
Email: $email
The visitor commented:
------------------------------
$message 
------------------------------
You can view the message at:
http://www.yoursite.com";
mail($mailTo, $mailSubject, $mailBody, $mailFrom);
mail($email, "Your Subject", "Thank you message", "From: [email][email protected][/email]");

}

print “&result=okay”;
exit;

?>

thanks for your help! I actually didn’t write this code though - I don’t know PHP I can just sort of understand it when I look at it - it is just part of the guestbook I am using, so I don’t really know how to code what you suggested - would it be long and complicated or a simple statement?