Import CSV file to database using PHP
Below is the code snippet that will let you import CSV file into database using PHP :
\n"; if(mysql_error()) { echo mysql_error() ."\n"; } } ?>
If the data is something like this:
"name","userid" "john","jon"
I only had to modify two lines from the original code :
$arr = explode(""", $line); $sql = "insert into test values (". implode("'", $arr) .")";