Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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 '
'
     IGNORE 1 LINES
    (field1,field2,field3,etc)
eof;

$db->query($query);
?>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #import #data #csv #db #php
ADD COMMENT
Topic
Name
1+3 =