This script is "How to implode csv file into a database".
<?php
//connect to the database$connect = mysql_connect("localhost","root","");
//select the table
mysql_select_db("your database name",$connect);
if (@$_FILES['csv']['size'] > 0) {
//get the csv file
@$file = $_FILES['csv']['tmp_name'];$handle = fopen(@$file,"r");
//loop through the csv file and insert into database
do {if ($data[0]) {
$val = explode(';',$data[0]);
mysql_query("INSERT INTO your table name set contact_first='".str_replace('"','',($val[1]))."',contact_last='".str_replace('"',''
($val[2]))."',contact_email='".str_replace('"','',($val[3]))."'");
}
}
while ($data = fgetcsv($handle,1000,",","'"));
//redirect
header('Location: import.php?success=1'); die;
}
?>

Vinod VermaPosted May 30, 2013, 7:18 AM
Hi%20Friends%2C%20I%20hope%20that%20this%20script%20will%20help%20you.