Jump to content

Replace database contents with xml file


hcanning2012

Recommended Posts

Hi Guys,

new to php so wondering how to automatically import an xml file into my mysql db and overwriting the contents.

Say I have a db called db1 and table called table1 with fields 'first name' and 'last name'. Lets say I export the db as xml, empty the tables and and want to repopulate the db with the exported xml file using a php file specifically?

How would I do that? Not having success with https://stackoverflow.com/questions/5491056/how-to-import-xml-file-into-mysql-database-table-using-xml-load-function

Thought someone may know a sample using a db config file connection to a mysql db?

Thanks

Link to comment
Share on other sites

There isn't an automated process because there is no sort of official database dump schema for XML. You have to write code to load the XML, loop over it as needed, and execute whatever queries you have to.

 

If you need help with that then you need to post what code you have and an explanation of what is not working.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.