loonatik
04-07-2003, 01:52 PM
Using the basic syntax for appending files:
$filename = "message.txt";
$fp = fopen($filename, "a") or die("couldn't open $filename");
flock($fp, LOCK_EX);
fwrite($fp, "hello, this is testing");
flock($fp, LOCK_UN);
fclose($fp);
//reload to see new message. how?
The text is appended at the end of whatever is already in message.txt. How can I make it so that it appends at the top of the file instead? So that new messages are at the top.
Also, what is the code to tell the page to reload?
thanks very much.
$filename = "message.txt";
$fp = fopen($filename, "a") or die("couldn't open $filename");
flock($fp, LOCK_EX);
fwrite($fp, "hello, this is testing");
flock($fp, LOCK_UN);
fclose($fp);
//reload to see new message. how?
The text is appended at the end of whatever is already in message.txt. How can I make it so that it appends at the top of the file instead? So that new messages are at the top.
Also, what is the code to tell the page to reload?
thanks very much.