mr e
07-24-2002, 08:13 AM
Ok all I'm trying to do is append text to a .txt file then I call the .txt file via include("blank.txt") but everytime I write to it, it either overwrites most of the previous text or trunacates everything and starts over...this is what I have so far.
$file = fopen($filename,"w+b");
$content = fread($file, filesize($filename));
fwrite($file,$news,strlen($news));
fwrite($file,$content,strlen($content));
fclose($file);
$news is the text I'm trying to append and I was trying to gather the text in the .txt file with $content then write them both back but that didn't work. Also whatever gets appended needs to be at the top because I want to use this as a news script. Any ideas?
$file = fopen($filename,"w+b");
$content = fread($file, filesize($filename));
fwrite($file,$news,strlen($news));
fwrite($file,$content,strlen($content));
fclose($file);
$news is the text I'm trying to append and I was trying to gather the text in the .txt file with $content then write them both back but that didn't work. Also whatever gets appended needs to be at the top because I want to use this as a news script. Any ideas?