data from mySQL into CSV for Excel?
Collapse
This topic is closed.
X
X
-
how can we write a data to csv file(Excel) from php or from database thr php.please help me :mad: -
Guest repliedRe: data from mySQL into CSV for Excel?
"LRW" <deja@celticbea r.com> wrote in message
news:3a1d1813.0 310021038.1c955 051@posting.goo gle.com...[color=blue]
> I've a survey form that I need to get data from and put into a mySQL
> database.
> Easy, can do it eyes closed.
>
> But, then I need to be able to take that same information and convert
> it (either directly or pulling it back out from the database) into a
> CSV (or any file for that matter) that can be easily imported, added
> into an existing Excel database.
>
> I've no idea how to do that. (I can query the database, that I can do,
> and create recordsets, AND create text files, but I've never created a
> CSV file before.)
>
> Is there a source, a good Web site for example, that explains that
> kind of process pretty well?
>
> Thanks!
> Liam
> druid -at-celticbear -dot- com[/color]
It's easy really.
Just get the data line by line and write the values sepearated by a comma.
Don't forget to put a linebreak at the end of each line
eg: $line[]="$name , $address \r\n";
Then loop through the $line array and write file.
Hope this helps
RG
Leave a comment:
-
Guest repliedRe: data from mySQL into CSV for Excel?
deja@celticbear .com (LRW) wrote in message news:<3a1d1813. 0310021038.1c95 5051@posting.go ogle.com>...[color=blue]
> I've no idea how to do that. (I can query the database, that I can do,
> and create recordsets, AND create text files, but I've never created a
> CSV file before.)
>
> Is there a source, a good Web site for example, that explains that
> kind of process pretty well?
>[/color]
Surely then you're familiar with the implode function?
See example 1
CSV is just a text file with the fields/columns separated by commas..
Leave a comment:
-
data from mySQL into CSV for Excel?
I've a survey form that I need to get data from and put into a mySQL
database.
Easy, can do it eyes closed.
But, then I need to be able to take that same information and convert
it (either directly or pulling it back out from the database) into a
CSV (or any file for that matter) that can be easily imported, added
into an existing Excel database.
I've no idea how to do that. (I can query the database, that I can do,
and create recordsets, AND create text files, but I've never created a
CSV file before.)
Is there a source, a good Web site for example, that explains that
kind of process pretty well?
Thanks!
Liam
druid -at-celticbear -dot- com
Tags: None
Leave a comment: