Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...This has been the MOST helpful forum that I have been a part of and I want to say thank you. The tips, tricks and helpful advice that you all contribute to have been lifesavers in many instances..."

Geography

Where in the world do Tek-Tips members come from?

importing xml to a database table

sridharvarma (Programmer)
15 May 12 3:22
i hvae an xml file,which was exported by phpmyadmin.Now i want to import that xml file to a database table with "load xml" or using php..please help me...

Load xml is inserting the xml values of only one column...

Here is my xml file:

<?xml version="1.0" encoding="utf-8"?>
<!--
- phpMyAdmin XML Dump
- version 3.3.9
- http://www.phpmyadmin.net
-
- Host: localhost
- Generation Time: May 15, 2012 at 06:55 AM
- Server version: 5.5.8
- PHP Version: 5.3.5
-->

<pma_xml_export version="1.0" xmlns:pma="http://www.phpmyadmin.net/some_doc_url/">
<!--
- Structure schemas
-->
<pma:structure_schemas>
<pma:database name="polls" collation="latin1_swedish_ci" charset="latin1">
<pma:table name="sample">
CREATE TABLE `sample` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(250) NOT NULL,
`sal` int(11) NOT NULL,
`depat` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
</pma:table>
</pma:database>
</pma:structure_schemas>

<!--
- Database: 'polls'
-->
<database name="polls">
<!-- Table sample -->
<table name="sample">
<column name="id">1</column>
<column name="name">siddu</column>
<column name="sal">25000</column>
<column name="depat">10</column>
</table>
<table name="sample">
<column name="id">2</column>
<column name="name">raju</column>
<column name="sal">25000</column>
<column name="depat">14</column>
</table>
<table name="sample">
<column name="id">3</column>
<column name="name">prakash</column>
<column name="sal">28000</column>
<column name="depat">15</column>
</table>
<table name="sample">
<column name="id">4</column>
<column name="name">goutham</column>
<column name="sal">20000</column>
<column name="depat">20</column>
</table>
<table name="sample">
<column name="id">5</column>
<column name="name">manoj</column>
<column name="sal">98000</column>
<column name="depat">12</column>
</table>
</database>
</pma_xml_export>


And my xml query is:

LOAD XML LOCAL INFILE 'PATH OF XML FILE' INTO TABLE 'T_NAME' rows IDENTIFIED BY '<table>';
Then it is inserting only the 'id' column values and the second column values are 'depat' only...
Y i am getting like this.

Thank you in advance....

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close