Reputation: 23
How can I export the contents of a mysql table to xml using php? I need this to de done and later on use this xml in a javacript application. The table is pretty simple an ID that is auto incremented , a name , a number , and a timestamp. I am using XAMPP 1.7.4 [PHP: 5.3.5] . And another question... where will the xml file be stored after it is created?
Upvotes: 2
Views: 2920
Reputation: 12381
If this is a one-off operation and you are okay with doing it manually, phpMyAdmin supports exports to various formats, including XML: http://wiki.phpmyadmin.net/pma/export. You get to chose the location of resulting file.
If you have to do it programmatically, I suppose you'll have to run the mysqldump with the --xml flag from your script and read the resulting file (I'm pretty sure that's what phpMyAdmin does). Use the --tab
option or I\O redirecting to create dump files where you want them.
Upvotes: 3