My PHP script is calling MySQL and getting bunch of records. Is there a function/library in PHP that converts SQL database records into XML? Something like myDBRecords.ToXML()
2 Answers
You probably want something like XML_Serializer. It will take just about any PHP data structure and return you some XML.
Comments
The command line allows to do
shell> mysql --xml -uroot -e "SHOW VARIABLES LIKE 'version%'"
I don't know if is possible replicate this behavior on SELECT statement
More information in:
http://dev.mysql.com/doc/refman/5.0/en/mysql-command-options.html#option_mysql_xml
Other way to do is using a custom class, an example: