Saturday, 10 February 2007
Learn to Export Database Schema as XML in PHP |
| |
|
| |
The WebCheatSheet web site has posted an article on how to export database schema as XML in PHP. In the course of the tutorial, a script is illustrated to read a schema from a MySQL database. The function outputs XML that describes the schema.
The first step that is described is to connect to a MySQL database and use the SHOW TABLES command to return all the tables in the database. Next, the same thing is iterated over each table and it return the fields for each table using the SHOW FIELDS command. Finally, all of the returned information is put into XML.
A look at the example code clarifies the concept. But a thing to be noted is that this code is specific to MySQL database. The commands such as SHOW TABLES and SHOW FIELDS are also available for other databases but are specified slightly differently. |
| |
|
Read the Article
|
| |
|
|
| |
|
|
| |
|