Description
GOModel 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
$GOModel = new GOModel(); //create object of the GOModel class /* csv to array function */ $records = $GOModel->csvToArray("emp.csv");
More Examples
//Example 2 $records = $GOModel->csvToArray("emp.csv"); $GOModel->insertBatch("emp", $records);
Result/Output
Return array
Debug
Option | Details | Example |
---|---|---|
print_r($GOModel->error) | Print errors (if any) |