Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import XML dada into MySQL

Status
Not open for further replies.

EnergyLevel

Technical User
Jul 27, 2001
7
GB
I want to import XML data into a MySQL database, preferable using a PHP backend. Has anyone experience of doing this and can give me a few pointers please ..


Thanks.........
 
Firstly, silly comment - the word dada in your header adds a whole new meaning !!!
Second.
What do you want to do with the XML ?. Do you want to have it held as nodes or just the entire document?
 
Hopefully one of the forum administrators will have pity on me and change the 'dada' typo !!

I'm not sure myself what information is going to be used from the XML file, I have a hunch it will be required to take only some of the data from the XML file.

Existing PHP backend has standard DB management i.e. fill in form fields click submit and data is edited/added to MySQL DB, now several new columns need to be added to MySQL DB the information for these additional columns is contained in existing XML files (these XML files do contain additional data which isn't required too).

So target is to add an import button to the existing backend that will parse the XML and strip out only the information required and drop it in to the corresponding columns in MySQL DB.

I've no idea pretty much about XML to be truthful so if I speaking in the wrong language and confusing the issue, I'll apologise now !!
 
I think what you need to do is parse the XML (either using SAX or DOM) to get the variables and then put them into the db.
I think the XML handling is differennt between php 4 and php5.
To be honest spending some time getting a grip on XML parsing is time well spent. The event driven method (SAX) is the easiest to get started with, need some extra help drop a line here.
 
Should have said, post some XML here with the variables you want out and I'll have a little try for you.
 
I'll post a snippet from the XML file tomorrow, don't have it handy at the moment, I may just pay a good PHP developer to do this for me yet, it's nice to learn something new but I don't have think I have the time at the moment ....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top