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-disposition: attachment; filename=backup_ijasah.xls"); // filename
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
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.