You need to copy the contents of the current file.
Then recreate the file by writing the new message then writing back the
original contents.

e.g.
$fname = basename($PHP_SELF). ".comment";
$fsize = filesize($fname);
fp = fopen(basename($fname));
$data = fread($fp,fsize);
fwrite($fp,$message);
fwrite($fp,$data);
fclose($fp);

-Stewart

-----Original Message-----
From: adam [mailto:[EMAIL PROTECTED]]
Sent: 22 March 2001 11:17
To: [EMAIL PROTECTED]
Subject: [PHP] please help with this simple problem


i am coding a simple script to post a text area into a file. it works, but
it posts it at the bottom and i wanted to have it post to the top of the
text already there..

here's a snip of the important part of the script:

$fp = fopen (basename($PHP_SELF) . ".comment", "a");
 fwrite ($fp, $message);
 fclose ($fp);
 }

any help would be much appreciated



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to