dcsimg

Dynamic XML with PHP

January 19, 2007

[From PHPBuilder]

In this article I will show how to generate dynamic XML documents with Object-Oriented PHP. Before I get started, let's get right to the heart of this functionality. Although the code may look fancy, being packaged up inside objects and inheritance, the key elements of this functionality rest in the the mysql_list_fields() and mysql_num_fields() functions.

What they do is get a field list array and a column count for a given table in a database. The way that we'll be able to have a generic XML output method in our class is by taking advantage of these features. So, in simplicity, instead of outputting our XML by handcoded column names, we are going to create a method that dynamically creates XML output with only a record id and the table name to query from. The implementation, however, is a bit more complex.

The article continues at http://www.phpbuilder.com/columns/ben_robinson200701017.php3








The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers