If I understand correctly, you're asking what query to execute (and how to put the result in a textfile) to get the results you want?
The first part is described thorougly in the mysql-manual (chapter 14.1.7 for example, search for the SELECT syntax or examples. You'll find it at http://dev.mysql.com/doc/mysql/en/ ). You probably need a query that looks like this:
SELECT e_mail FROM your_table_name WHERE discipleship_mailing_list_e_mail_subscription = "on";
This will return all the requested e-mail adresses.
Having this information printed to a file could be reached by using the INTO OUTFILE form of SELECT. Again, check the mysql-manual. for the exact syntax, but you'll probably end up with somthing like:
SELECT e_mail INTO OUTFILE '/some/filename.text' FROM your_table_name WHERE discipleship_mailing_list_e_mail_subscription = "on";
There are a bunch of other options and solutions, though this seems the easiest one to me. Mind that if you try to do this in PHP (and trough a webserver), the webserver should have write-access to the file you specify with 'OUTFILE' - that might be a problem. Personally, I'd run this as some sort of batch script (using the mysql command line interface with the -e option, for example).
Hope this helps you along a bit.
Guus der Kinderen
Ron Piggott wrote:
I have created a MySQL database. The table I am creating is a subscriptions database. I want to be able to export all e-mail addresses stored in the "e_mail" column into a plain text file on the web server (1 e-mail address per row) where the "discipleship_mailing_list_e_mail_subscription" equals "on". I am new at PHP and I am not sure how to do this yet.
My idea is that the user would click an "UPDATE" button and this action would be performed. Are any of you able to help me with this?
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php