Exporting Database Records To XML

As the web moves to an XML-based paradigm, one of the most common problems faced by developers involves converting legacy data, usually stored in a database, into corresponding XML data. With this in mind, let’s look at some practical examples that demonstrate how data stored in an SQL-compliant database system can be converted into well-formed XML.

Note that the code listings in this section assume the existence of a MySQL database and a familiarity with PHP’s database access functions (specifically, its MySQL functions). In case you don’t already have MySQL, you can download it from http://www.mysql.com/, and SQL dump files for the database tables used in this section may be obtained from this book’s companion ...

Get XML and PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.