PDO Import Function - XML Import import data from xml directly using GOModel helper functions

Description

GOModel import from xml functions allows to import data from xml by passing xml file. File name and database table name needs to be passed in function. With the help of this you can insert record in database by calling insert or insertBatch function.

Function Defination

  
                                void function xmlToArray($xmlSource) ;
                                

Parameters Details

Details Type Example
$xmlSource - Name or path of xml file string file name like "xyz.xml" or "upload/xyz.xml"

Examples

  
                                $GOModel = new GOModel(); //create object of the GOModel class
                                /* xml to array function */
                                $GOModel->isFile=true;
                                $records = $GOModel->xmlToArray("emp.xml");
                              
                            

More Examples

 
                                //Example 2 
                                $GOModel->isFile=true;
                                $records = $GOModel->xmlToArray("emp.xml");
                                $GOModel->insertBatch("emp", $records);

                            

Result/Output

Record will be inserted in database

Debug

Option Details Example
print_r($GOModel->error) Print errors (if any)