Description
PDOModel import from csv functions allows to import data from csv by passing csv file. File 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 csvToArray($fileName) ;
Parameters Details
| Details | Type | Example |
|---|---|---|
| $fileName - Name or path of csv file | string | file name like "xyz.csv" or "upload/xyz.csv" |
Examples
$pdomodel = new PDOModel(); //create object of the PDOModel class
/* csv to array function */
$records = $pdomodel->csvToArray("emp.csv");
More Examples
//Example 2
$records = $pdomodel->csvToArray("emp.csv");
$pdomodel->insertBatch("emp", $records);
Result/Output
Return array
Debug
| Option | Details | Example |
|---|---|---|
| print_r($pdomodel->error) | Print errors (if any) |