April 15, 2012

Importing XML in to phpmyadmin database

Question by paulyay

I’m trying to import XML from this site http://data.gov.uk/dataset/car-parks to a phpmyadmin database, so I can use it in a google maps mashup.

I’m new to this and not sure how to go about getting the XML in to the database. Do I create the database columns first and then import the data?

Answer by Starx

There is a LOAD XML method in mysql, through which you can import the data from XML into your database.

An Example:

LOAD XML LOCAL INFILE '/pathtofile/file.xml' 
INTO TABLE `tablename` (fieldl1, field2, ...);

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+


Please fill the form - I will response as fast as I can!