ik doe zoiets als dit:
$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 );
ik zie je niet gebruiken fgetcsv
function.and, heb je in de tussentijd geprobeerd de gegevens te herhalen? gebruik zoiets als dit:
echo $i." line query ".$query." <br>";
BEWERKEN
probeer dit:
$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);