Description
PDOModel 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
$pdomodel = new PDOModel(); //create object of the PDOModel class
/* xml to array function */
$pdomodel->isFile=true;
$records = $pdomodel->xmlToArray("emp.xml");
More Examples
//Example 2
$pdomodel->isFile=true;
$records = $pdomodel->xmlToArray("emp.xml");
$pdomodel->insertBatch("emp", $records);
Result/Output
Record will be inserted in database
Debug
| Option | Details | Example |
|---|---|---|
| print_r($pdomodel->error) | Print errors (if any) |