Re: Exporting mySQL to Excel

From: Date: Wed, 09 Nov 2011 23:32:34 +0000
Subject: Re: Exporting mySQL to Excel
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-48085@lists.php.net to get a copy of this message
I have tried to implement a CSV solution. Following a CSV header each field is displayed using this syntax: (Except the last doesn't end with a , but \r\n ) echo "\"" . trim( str_replace( '"' , '""' , stripslashes( mysql_result($listing_result , $i , "ministry_profiles.address_line_1") ) ) ) . "\" , "; I have these 2 problems: - Excel isn't providing a popup screen for me to specify the content of each field is contained within a pair of " and , is used to separate each field. - Additionally Excel is interpreting a comma as the start of a new field. This is problematic in fields where a comma legitimately exists in the middle of a field. I am wondering how phpmyadmin makes Excel files "on the fly" --- Is it a class? I am unsure how to proceed. Ron Piggott www.TheVerseOfTheDay.info -----Original Message----- From: Jimi Thompson Sent: Tuesday, November 08, 2011 4:59 PM To: Ron Piggott Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Exporting mySQL to Excel The best option I've found is to write to a file that is then sent to the browser for download. Are there others? Yes but that's the one I've had the best experience with. It seems to work reliably regardless of browser or version of Office or any thing else. HTH! On Tue, 2011-11-08 at 13:31 -0500, Ron Piggott wrote:
What is the preferred method used to export mySQL to Excel within the context of PHP? I have looked on Google and found a wide variety of options. Ron
Ron Piggott www.TheVerseOfTheDay.info


« previous php.db (#48085) next »