0

I have exported an XML from phpmyAdmin. I want to imported it back to MySQL by using PHP code. How can i do it? And here is Exported XML

<?xml version="1.0" encoding="utf-8"?>
<!--
- phpMyAdmin XML Dump
- version 4.1.14
- http://www.phpmyadmin.net
-
- Host: 127.0.0.1
- Generation Time: Dec 30, 2015 at 03:18 AM
- Server version: 5.6.17
- PHP Version: 5.5.12
-->

<pma_xml_export version="1.0" xmlns:pma="http://www.phpmyadmin.net/some_doc_url/">
    <!--
    - Structure schemas
    -->
    <pma:structure_schemas>
        <pma:database name="projectx" collation="latin1_swedish_ci" charset="latin1">
            <pma:table name="i_tariff_block">
                CREATE TABLE `i_tariff_block` (
                  `Client_Name` char(255) NOT NULL DEFAULT '',
                  `Document_No` char(10) NOT NULL DEFAULT '',
                  `Doc_Type` char(10) NOT NULL DEFAULT '',
                  `Line_No` int(3) NOT NULL DEFAULT '0',
                  `Block_Tariff` decimal(14,2) DEFAULT NULL,
                  `Consumption` decimal(14,2) DEFAULT NULL,
                  `Rate` decimal(14,2) DEFAULT NULL,
                  `Amount` decimal(14,2) DEFAULT NULL,
                  `Create_Date` date DEFAULT NULL,
                  `Create_Time` time DEFAULT NULL,
                  `Create_By` char(10) DEFAULT NULL,
                  `Change_Date` date DEFAULT NULL,
                  `Change_Time` time DEFAULT NULL,
                  `Change_By` char(10) DEFAULT NULL,
                  PRIMARY KEY (`Client_Name`,`Document_No`,`Doc_Type`,`Line_No`)
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
            </pma:table>
        </pma:database>
    </pma:structure_schemas>

    <!--
    - Database: 'projectx'
    -->
    <database name="projectx">
        <!-- Table i_tariff_block -->
        <table name="i_tariff_block">
            <column name="Client_Name">ABA10</column>
            <column name="Document_No">2841033814</column>
            <column name="Doc_Type">I</column>
            <column name="Line_No">1</column>
            <column name="Block_Tariff">200.00</column>
            <column name="Consumption">200.00</column>
            <column name="Rate">0.00</column>
            <column name="Amount">44.00</column>
            <column name="Create_Date">NULL</column>
            <column name="Create_Time">NULL</column>
            <column name="Create_By">NULL</column>
            <column name="Change_Date">NULL</column>
            <column name="Change_Time">NULL</column>
            <column name="Change_By">NULL</column>
        </table>
    </database>
</pma_xml_export> 
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
sophanith
  • 83
  • 1
  • 2
  • 8
  • I would guess there's a PMA import tool that allows you to submit this file. If not, run the `CREATE TABLE` part in PMA, then manually enter the one line of data. – Jared Farrish Dec 31 '15 at 03:58
  • [Try this](http://stackoverflow.com/questions/14234563/import-xml-with-attributes-into-mysql) It has been asked before – Kamaldeep singh Bhatia Dec 31 '15 at 06:12

0 Answers0