Kamis, 14 Januari 2010

Export MySQL Query to excel with PHP

I still need learn a lot of PHP Programming. A Reporting is Important in Information System. People usually use PDF an Excel in Reporting. Don't be confuse, it was an easy way to produce a report from mysql database with PHP Programming.

A lot of people maybe confuse how to Export MySQL Query to excel with PHP. Because we usually learn query, connection, show data and manipulation data first. A reporting is final step if we do a programming of a system development .

We Just need a Connection, a Table that contain MySQL Row and This Great Script ..


header("Content-type: application/vnd.ms-excel");

header("Content-disposition: attachment; filename=backup_ijasah.xls"); // filename
header("Pragma: no-cache");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");


<?php
1.Connection File
2.The Script above
3. The MySQL Table from A PHP MySQL Query : Example just produce like this :

?>


Just add the Highlighting syntax above at the top line of your coding.. (It Can be Under Include Connection.php line).

After you call your File from Web Browser You Wil Get Like This



Well Done You Can Produce an Excel File that Export MySQL Query to excel with PHP.






Related Post:

Tidak ada komentar: