You are here: Re: AW: [PHP] export mysql to csv prob « PHP « IT news, forums, messages
Re: AW: [PHP] export mysql to csv prob

Posted by Tom on 02/11/05 11:48

If your mysql server has access (or can have access) to the directory
where you want to dump the file, you can just use the "SELECT.... INTO
OUTFILE FIELDS TERMINATED BY ','..." syntax as your query, which is very

Mirco Blitz wrote:

>Probably the Pear Excel_Syltesheet_Writer works for you.
>I found out that it is faster with huge data sets on my system.
>-----Ursprüngliche Nachricht-----
>Von: Redmond Militante []
>Gesendet: Freitag, 11. Februar 2005 00:02
>Betreff: [PHP] export mysql to csv prob
>i have a script that exports the result of a mysql query to a csv file
>suitable for downloading
>the code looks like
>$result = mysql_query("select * from user,mjp1,mjp2,mjp3,mjp4");
>while($row = mysql_fetch_array($result)) {
> $csv_output .= "$row[userid] $row[firstname] $row[lastname]\n" }
> header("Content-type: application/");
> header("Content-disposition: csv" . date("Y-m-d") . ".xls"); print
>this works fine, except that when i expand the line $csv_output
>.="$row[userid] $row[firstname] $row[lastname] $row[anotherfield]
>$row[anotherfield] ...\n"} -to include an increasing number of fields, it
>tends to bog down the speed at which the $csv_output file can be printed.
>when i have this line output 30+ fields for each row, wait time for output
>file generation is almost 4-5 minutes.
>is this the most efficient way to do this? i'd like to be able to generate
>the file as quickly as possible.
>Redmond Militante
>Software Engineer / Medill School of Journalism FreeBSD 5.2.1-RELEASE-p10
>#0: Wed Sep 29 17:17:49 CDT 2004 i386 4:45PM up 4:01, 3 users, load
>averages: 0.00, 0.00, 0.00



[Reply to this message]

Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация