PHP - MySQL - XML tutorial - basics: Difference between revisions
mNo edit summary |
|||
Line 1: | Line 1: | ||
{{Stub}} | {{Stub}} | ||
{{under construction}} | |||
== Introduction == | == Introduction == | ||
<div class="tut_goals"> | |||
; Objectives | |||
[[XML]] is often used to transport data between applications. In this tutorial (once it's fully done) we shall see how to: | [[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 | * Store simple XML data (e.g. tabular data) in MySQL | ||
* Query a database with SQL, get the result in XML and render in HTML | * Query a database with SQL, get the result in XML and render in HTML | ||
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. | ; 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. | |||
</div> | |||
== Rendering a database query with XSLT == | == Rendering a database query with XSLT == | ||
This example shows PHP | |||
=== Retrieving data as XML === | === Retrieving data as XML === | ||
Since SQL query results | Since SQL query results | ||
== Further explorations == | |||
=== Other tutorials === | |||
* [http://www.kirupa.com/web/mysql_xml_php.htm Output mySQL data as XML with PHP] by Jubba, Kirupa.com. (easy) | |||
* [http://dev.mysql.com/tech-resources/articles/xml-in-mysql5.1-6.0.html 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): | |||
* [http://www.phpclasses.org/browse/package/2536.html XML 2 PHP and PHP 2 XML] | |||
* [http://www.phpclasses.org/browse/package/1084.html DbToXML] | |||
[[Category: XML]] | [[Category: XML]] |
Revision as of 22:38, 7 February 2010
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):