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: <[EMAIL PROTECTED]>
To: "Viorel Dragomir" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, January 09, 2004 17:52
Subject: Re: [PHP-DB] 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" <[EMAIL PROTECTED]>
> 09/01/2004 15:50
>
> To
> <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
> cc
>
> Subject
> Re: [PHP-DB] 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: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, January 09, 2004 17:35
> Subject: [PHP-DB] 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

Reply via email to