Upload Csv Insert To MySql
from : http://howto.indika.net.id/wikka.php?wakka=UploadCsvInsertToMySql
< ?php
//First we need to define our user pass and database name
$tbl = “yourtablename”;
$host=”yourdatabasehost”;
$user=”youruser”;
$pass=”yourpass”;
$database=”yourdatabase”;
//we need function to get the csv
function getcsv($filename, $delim =”,”){
$row = 0;
$dump = array(); //create new array for hold the data csv
$f = fopen ($filename,”r”);
$size = filesize($filename)+1;
while ($data = fgetcsv($f, $size, $delim)) {
$dump[$row] = $data; //put the data to array
//echo $data[1].”
“;
$row++;
}
fclose ($f);
return $dump;
}
(more…)



