0

I am trying to export just the rows of a mysql table without the table information to an xml file. I read that the mysqldump command will get the job done but I cant manage to get the correct syntax. Can someone post an example code for mysqldump command? Thank you.

$command="mysqldump --xml ";
2
  • manual knows all: dev.mysql.com/doc/refman/5.5/en/mysqldump.html Commented Sep 22, 2011 at 20:12
  • mysqldump --xml name_of_database at minimum. It won't dump everything for you unless you explicitly pass in the `--all-databases option. Commented Sep 22, 2011 at 20:13

2 Answers 2

1

Try the script on this page: http://www.chriswashington.net/tutorials/export-mysql-database-table-data-to-xml-file

Sign up to request clarification or add additional context in comments.

Comments

0

By any chance you are not trying to run that command inside mysql_query are you ? It wont work that way. mysqldump is a command line utility.

To run it from php you would need to use the system() function, documentation - http://php.net/manual/en/function.system.php

If you are on a shared host with PHP in safe mode, or the system function is explicitly disabled in php.ini, then you will not be able to do this.

In that case you would need to read the data from your table using a SELECT query and iterating on all rows and potting it into an XML file, using XMLWriter or DOMDocument

1 Comment

i am not sure what system() function is but i m going to check it out

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.