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


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"


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

More Examples

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



Record will be inserted in database


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