News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

TotalPHP.com:
Creating a text or csv file of information from your database
December 10, 2008 @ 08:47:44

On the TotalPHP site there's a new tutorial showing how to pull data from your database and export it as a CSV file that tools like Excel can read in and use.

There are some occasions where you would want to export your site's information in CSV or similar text format. You might want to do this so you can view reports in a spreadsheet, or you might want an export of your product information to upload to a service like Google Products. Either way the method and end result are essentially the same.

The tutorial shows how to grab the information (via the mysqli functionality in PHP5) and formatting each row with the correct values in a certain order. Finally, the entire contents are echoed back out with the correct header() to force a download on the user's browser.

0 comments voice your opinion now!
csv tutorial mysqli database export txt format


blog comments powered by Disqus

Similar Posts

PHPro.org: Class Hierachies And Overriding

SitePoint PHP Blog: Using Solarium with SOLR for Search Implementation

Graham Bird's Blog: Extra-pretty URLs with slugs

ProDevTips: Sorting 2D-arrays in PHP - anectodes and reflections

Ralph Schindler's Blog: Compiling Gearman (or anything) for Zend Server CE on Snow Leopard


Community Events

Don't see your event here?
Let us know!


library introduction install voicesoftheelephpant unittest api release interview podcast language xdebug example series framework opinion community laravel php7 version extension

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework