PHP - MySQL - XML tutorial - basics
This article or section is currently under construction
In principle, someone is working on it and there should be a better version in a not so distant future.
If you want to modify this page, please discuss it with the person working on it (see the "history")
Introduction
- Objectives
XML is often used to transport data between applications. In this tutorial (once it's fully done) we shall see how to:
- Store simple XML data (e.g. tabular data) in MySQL
- Query a database with SQL, get the result in XML and render in HTML
- Prerequisites
- A little bit of PHP
- Some SQL (see the SQL and MySQL tutorial)
- XML (basic concepts)
- XSLT (for some parts, see XSLT Tutorial - Basics
- Remark
We don't plan to write a tutorial on how to store complex XML data in an SQL database, because it's a too difficult subject for educational technology or computer application students. We rather suggest to an XML database for that.
Rendering a database query with XSLT
This example shows PHP
Retrieving data as XML
Since SQL query results
Further explorations
Other tutorials
- Output mySQL data as XML with PHP by Jubba, Kirupa.com. (easy)
- Using XML in MySQL 5.1 and 6.0 (shows for example how to create XML result sets with a simple MySQL or SELECT commands).
Sticking XML into a MysQL table
... to be written ...
Using libraries
Since sticking XML (in particular certain applications like RSS into MySQL and retrieving a result set as XML is a frequently encoutered problem, you also may consider various PHP libraries that do the job.
Example (none tested):