INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • 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!

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

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

importing xml to a database table

importing xml to a database table

(OP)
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....

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

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!

Resources

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