From the course: PHP: Exporting Data to Files

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Goodbye

Goodbye - PHP Tutorial

From the course: PHP: Exporting Data to Files

Start my 1-month free trial

Goodbye

That concludes our exploration of using PHP to export data to different formats. We began with a couple of simple scripts to export plain text and data in CSV format and then progress to using various classes to do the heavy processing. To export data to basic formats, we use three classes. All of which are capable of saving the output to a local file on the web server as well as generating the download file. The default output of the XML class offers a third option, exporting the data as an XML string. All three classes require a MySQL improved or PDO database result as their main argument. Although a CSV file opens automatically in Microsoft Excel, we also looked at a couple of open source libraries for generating spreadsheets. For Microsoft Excel we used PHPExcel. This is an extremely powerful library. With lots of options, and very detailed documentation. We used it to export a database result to an xlsx file. But PHPExcel is also capable of reading Excel spreadsheets and…

Contents