It is a problem having write access to the file. This is what the online mySQL manual says ... The SELECT ... INTO OUTFILE 'file_name' form of SELECT writes the selected rows to a file. The file is created on the server host, so you must have the FILE privilege to use this syntax. The file cannot already exist, which among other things prevents files such as `/etc/passwd' and database tables from being destroyed. The SELECT ... INTO OUTFILE statement is intended primarily to let you very quickly dump a table on the server machine. If you want to create the resulting file on some client host other than the server host, you can't use SELECT ... INTO OUTFILE. In that case, you should instead use some command like mysql -e "SELECT ..." > file_name on the client host to generate the file. I need to go with another option. Another person wrote me and suggested using the fopen(), fwrite() and fclose() commands. I haven't investigated this option yet. You know when you first learn to walk you do so by example ... I am still needing to know which commands to look up and try to apply to my situation. I have got some PHP code to work ... I am far from done the project I am working on. I was able to get the command: SELECT e_mail FROM subscriptionsdatabase WHERE discipleship_mailing_list_e_mail_subscription LIKE 'on' to work in the mySQL command prompt but when I put it into a .PHP file I get a parse error. I get that parse error by simply coping and pasting the command into the PHP file. In more detail what I am trying to do and why I e-mailed out the question is to wipe clean a mailing list data file and re-create the e-mail subscriptions data file based on which people joined the list during the week. I am still learning mySQL ... The things you wrote helped me "play" ... I didn't get too far in creating code, but I am learning at the same time. Thanks for the advice. Ron ----- Original Message ----- From: Guus der Kinderen <kinder@xxxxxx> Newsgroups: php.db To: Ron Piggott <ron.php@xxxxxxxxxxxxxxxxxx> Sent: Monday, August 09, 2004 7:22 PM Subject: Re: Exporting Data From MySQL Using PHP > Hello Ron, > > 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. > > Regards, > > 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? > > > > Thanks. Ron > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php