Re: export mysql to csv prob

From: Date: Fri, 11 Feb 2005 19:03:00 +0000
Subject: Re: export mysql to csv prob
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-208550@lists.php.net to get a copy of this message
hi, this pear package is working beautifully, but so far i've only managed to generate .xls docs. are there any formatting commands that would allow me to generate just a tab delimited text file? thanks redmond [Fri, Feb 11, 2005 at 12:41:42AM +0100] This one time, at band camp, Mirco Blitz said: > Hi, > Probably the Pear Excel_Syltesheet_Writer works for you. > http://pear.php.net/package/Spreadsheet_Excel_Writer > > I found out that it is faster with huge data sets on my system. > > Greetings > Mirco > > -----Ursprüngliche Nachricht----- > Von: Redmond Militante [mailto:r-militante@northwestern.edu] > Gesendet: Freitag, 11. Februar 2005 00:02 > An: php-general@lists.php.net > Betreff: [PHP] export mysql to csv prob > > hi > > 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/vnd.ms-excel"); > header("Content-disposition: csv" . date("Y-m-d") . ".xls"); > print > $csv_output; > > 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. > > thanks > redmond > > -- > 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 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Redmond Militante Software Engineer / Medill School of Journalism FreeBSD 5.2.1-RELEASE-p10 #0: Wed Sep 29 17:17:49 CDT 2004 i386 1:00PM up 1 day, 16 mins, 2 users, load averages: 0.06, 0.06, 0.02

« previous php.general (#208550) next »