I want to write a function that will take any SQL query as a parameter, and generate XML that represents the recordset.
If you are lucky enough to be using mysql ver 4.x+ -- it has this functionality built-in, using the --xml command line option.
Sample run :
$ mysql -u username -ppassword --xml
mysql> create table test (name text, pass text);
Query OK, 0 rows affected (0.00 sec)
mysql> insert into test (name,pass) values ('foo','secret');
Query OK, 1 row affected (0.00 sec)
mysql> select * from test;
<?xml version="1.0"?><resultset statement="select * from test">
<row>
<name>foo</name>
<pass>secret</pass>
</row>
</resultset>
1 row in set (0.00 sec)
mysql>If your mysql version is < 4.x -- then you have to resort of one of the many mysql-to-xml classes available (check phpclasses.org and PEAR).
-- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

