PDA

View Full Version : apend top?


Vince-Omatic
06-06-2006, 06:32 AM
hi,

I have this script which works wonderfully for writing to a txt for a guestbook.

<?php

$myFile = "guestbook.o";
$fh = fopen($myFile, 'a') or die("can't open file");

$stringData = "Name: " . $v_name . "<br>" . "Email: " . $v_email . "<br>" . "Comment: " ."<br>". $v_comment . "<br>" . "<br>";
fwrite($fh, $stringData);

echo "Comment Posted!";

fclose($fh);
?>


How can I get this to open from the top so the new comments are on top?


Thanks,

Vince

Flash Gordon
06-06-2006, 06:33 AM
'r+' Open for reading and writing; place the file pointer at the beginning of the file.
http://us3.php.net/manual/en/function.fopen.php

Vince-Omatic
06-06-2006, 10:04 AM
thank you

Flash Gordon
06-06-2006, 06:50 PM
:)