Using PHP 4s DOM XML Functions to Create XML Files from SQL Data
By Tony Marston2005-04-04
Intended Audience
This method completely splits the presentation layer (i.e. the generation of HTML documents) from the business layer (the application of business rules using a language such as PHP) so that any one of these layers can be modified without affecting the other.
In the samples below the code is generic in that no column names are ever hard coded. Data is retrieved from the database as an associative array (a series of 'name=value' pairs), and every element of the array is extracted and transferred to the XML file. The contents of the associative array are therefore governed entirely by the SQL 'select' statement.
In the samples below I will show how to deal with data from a single table, and then data from two tables with a one-to-many relationship. Finally I will show how to insert additional data in the form of XML attributes.
Tutorial pages:
|
|
|||||||||
You might also want to check these out:
|
Leave a Comment on "Using PHP 4s DOM XML Functions to Create XML Files from SQL Data"
You must be logged in to post a comment.
Link to This Tutorial Page!

