Getting there... That did indeed output my results to the screen... Next steo is to output that same data to a new file... I've done downloads on my site elsewhere, using header(), but with existing files... I guess I need to learn how to use fwrite? "Viorel Dragomir" <bc@xxxxxx> 09/01/2004 16:09 To <Tristan.Pretty@xxxxxxxxxxxxxxxx> cc <php-db@xxxxxxxxxxxxx> Subject Re: csv export...? It looks like is not so simple. But is not difficult at all.. Try to make something like: <?php header("Content-type: text/csv"); $query = "SELECT * FROM tables"; $result = mysql_query($query); while($row = mysql_fetch_row($result)){ print implode(",", $row); } mysql_free_result($result); ?> Check if functions like implode has the correct arguments. Anyway hopes it gives you a clue about what is going on. Don't forget to connect to database first of all. ----- Original Message ----- From: <Tristan.Pretty@xxxxxxxxxxxxxxxx> To: "Viorel Dragomir" <bc@xxxxxx> Cc: <php-db@xxxxxxxxxxxxx> Sent: Friday, January 09, 2004 17:52 Subject: Re: csv export...? > Cheers for prompt reply... > But.. what? > I need to take an SQL query, and export teh results to a csv file... > Are you really sure that simply pointing to a non existant csv file does > that? > I don't see it somehow...? > > I'm sorry if I'm wrong... > > > > > "Viorel Dragomir" <bc@xxxxxx> > 09/01/2004 15:50 > > To > <php-db@xxxxxxxxxxxxx>, <Tristan.Pretty@xxxxxxxxxxxxxxxx> > cc > > Subject > Re: csv export...? > > > > > > > You didn't try to hard isn't it! :) > If you want to save a file as csv just save the vars like this > 1,2,3 > 4,5,6 > ... > 0,0,0 > > If you want to link a csv file for download put <a > href='file.csv'>download</a>. > It's not so hard after all. :) > > Or I didn't get your message. > Anyway, good luck! > > > ----- Original Message ----- > From: <Tristan.Pretty@xxxxxxxxxxxxxxxx> > To: <php-db@xxxxxxxxxxxxx> > Sent: Friday, January 09, 2004 17:35 > Subject: csv export...? > > > > Google is not my friend today... > > I have a reportng tool on a database i have, and I want to be able to > > exort the selected results (I've saved the SQL query as a session > variable > > for ease of use) > > and save that data as a csv file... with headers if possible... > > > > Now I have found loadsa sites that let me upload a csv file, but not the > > other way around... > > > > Anyone care to help? > > > > ********************************************************************* > > The information contained in this e-mail message is intended only for > > the personal and confidential use of the recipient(s) named above. > > If the reader of this message is not the intended recipient or an agent > > responsible for delivering it to the intended recipient, you are hereby > > notified that you have received this document in error and that any > > review, dissemination, distribution, or copying of this message is > > strictly prohibited. If you have received this communication in error, > > please notify us immediately by e-mail, and delete the original message. > > *********************************************************************** > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > ********************************************************************* > The information contained in this e-mail message is intended only for > the personal and confidential use of the recipient(s) named above. > If the reader of this message is not the intended recipient or an agent > responsible for delivering it to the intended recipient, you are hereby > notified that you have received this document in error and that any > review, dissemination, distribution, or copying of this message is > strictly prohibited. If you have received this communication in error, > please notify us immediately by e-mail, and delete the original message. > *********************************************************************** > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ********************************************************************* The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***********************************************************************