RE: [PHP] please help with this simple problem
| From: | Stewart Taylor | Date: | Thu, 22 Mar 2001 11:29:23 +0000 |
| Subject: | RE: [PHP] please help with this simple problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-45095@lists.php.net to get a copy of this message | ||
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:adam@wangallery.com]
Sent: 22 March 2001 11:17
To: php-general@lists.php.net
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: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net