Page 1 of 1

fwrite() question

Posted: Fri May 09, 2008 1:53 pm
by remyx187
Hi,
I have a minor problem

I write to an empty txt file some data, but when I try to write again to that same file, the previously inputted data disappears and gets replaced with the new data. I was wondering why that is and if there is an "append" function that i can use other than fwrite(). Maybe im just doing something wrong and dont realize it.

thanks in advance.

Re: fwrite() question

Posted: Fri May 09, 2008 2:00 pm
by flying_circus
When you issue the fopen() method, look at the mode argument

http://us.php.net/manual/en/function.fopen.php

fopen('myfile','a'); // Appends the file
fopen('myfile','w'); // Overwrites the file

Re: fwrite() question

Posted: Fri May 09, 2008 2:09 pm
by remyx187
hey thanks, worked great, i knew it was simple