Hi I want to create new text files, say called ?????.txt And then add email address to these text files as users join the mailing list. Basically I have lots of users, that all need updating of information but only from certain people, so they enter their email address and this is saved in a text file called the users name and only thy are emailed accordingly. I can take care of all this apart from the creating and added to the text file. I imagine it is very easy but i am getting married on Friday and i have lots to do, so can someone please help me.
Regards Julian Chamberlain
You're right, it's very easy.
$filename = "file.txt"; $fd = fopen($filename, "a"); $contents = fread($fd, $somedata); fclose($fd);
This would append $somedata to the end of $filename.
And good luck with the whole marriage-thing. =)
sp0rk used fread, but said "this would append $somedata".
I'm assuming he did this accidently :-)
use fwrite($fd, $somedata) to write the data.
you cannot use fread right after you open a file for append unless you use fseek to reset the file pointer to the beginning of the file.
-sridhar
Um, yeah. I've been reading to many files today obviously... =)
Thanks guys!