jeg gør noget som dette:
$file = fopen("$link_file","r")or die("file dont exist");
while (!feof($file )){
$campo = fgetcsv($file,4096,",");
$loadsql = "INSERT INTO temporal_table(id,state,etc) VALUES ('$campo[0]','$campo[1]','etc');";
mysql_query($loadsql) or die(mysql_error());
}
fclose($file );
Jeg kan ikke se dig bruge fgetcsv
function.and, prøvede du at ekko dataene i et stykke tid? Brug noget som dette:
echo $i." line query ".$query." <br>";
REDIGER
prøv dette:
$csv_file = CSV_PATH . "new_Location.csv";
$file = fopen("$csv_file","r")or die("file error");
while (!feof($file)){
$insert_csv = fgetcsv($file,4096,",");
$query = "INSERT INTO City (
locId,
country,
region,
city,
postalCode,
latitude,
longitude //removed all the simple quotes..
) VALUES (
'$insert_csv[0]',
'$insert_csv[1]',
'$insert_csv[2]',
'$insert_csv[3]',
'$insert_csv[4]',
'$insert_csv[5]',
'$insert_csv[6]'
)";
mysql_query($query) or die(mysql_error());
}
fclose($csvfile);