I have compiled a script that will upload a CSV file and then extract the data into an already created table. I want to make sure that the first row (column headings) is not inserted into the table, but the rest of the data will be.
$fp = fopen($_SESSION['filename'],"r");
while (($data = fgetcsv($fp, 1000, ",")) !== FALSE)
{
$import="INSERT into csv_table(name,address,age) values('$data[0]','$data[1]','$data[2]')";
mysql_query($import) or die(mysql_error());
}
fclose($fp);
this is part of the code that I use to extract data from a csv file.
Thank you very much for any help in this matter!
source
share