how to import comma seperate csv file to database using php code example
Example: import data from csv to db php
<?php
$query = <<<eof
LOAD DATA INFILE '$fileName'
INTO TABLE tableName
FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(field1,field2,field3,etc)
eof;
$db->query($query);
?>