hcanning2012 Posted March 26, 2018 Share Posted March 26, 2018 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 Quote Link to comment Share on other sites More sharing options...
requinix Posted March 27, 2018 Share Posted March 27, 2018 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. Quote Link to comment Share on other sites More sharing options...
Barand Posted March 27, 2018 Share Posted March 27, 2018 This section of the manual may be of interest https://dev.mysql.com/doc/refman/5.7/en/load-xml.html 1 Quote Link to comment Share on other sites More sharing options...
benanamen Posted March 27, 2018 Share Posted March 27, 2018 This sounds like an XY problem. What is the real problem you are trying to solve, not your attempt at solving it? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.