Hello. I have a database with many columns, like username, password etc. One of these is 'email'. I want each time a new user is added to the database, the mail to be added to a txt file. All in all, i want to have all the e-mails in a txt file one under the other. The txt file should be updated and rewrited every time a new mail is added. Is it possible? Thanks, G-hamsteR
Let's say the file you want your e-mails in is called emails.txt and e-mail is in variable $email Then you should do the following to add that e-mail to emailst.txt in a new line: $email=$email."\n"; $fp=fopen("emails.txt","a"); fwrite($fp,$email,strlen($email)); fclose($fp); You should set the right permissions for the file - give the script the right to write in it.
Admittedly, I don't know your specific use case, but wouldn't it be easier to just have the text listing of email addresses created on demand?