September 11, 2012 6:33 am

Create Stream of CSV in PHP

CSV Streaming is a method for users to export their data in excel, a way for user to backup hosted data or send report to users.

In this tutorial we have are working on how we can export data in CSV to your customers.

PHP Code

Start by sending the headers to allow the user to download the csv file Download.php

Database configuration file you have to modify username, password and database name values.

Select Data from database to write in your csv file bellow code will write your csv file.


Author Huzoor Bux

I am Huzoor Bux from Karachi (Pakistan). I have been working as a PHP Developer from last 5+ years, and its my passion to learn new things and implement them as a practice. Basically I am a PHP developer but now days exploring more in HTML5, CSS and jQuery libraries.

Tutorial Categories:
  • Angel

    hi, i’m has been read your blog for the last year and really help me to much in my projects… I have a question. How can get in the header the name of columns of database table instead array_keys($data)?

  • Max John

    Which one is db.php ? I can see include db.php but it seems you did not mention which file is that . Is that the file that enables to connect to mysql ?