i imported the csv file data and stored in php mysql succefully without header, when i include header in csv,it takes it as data , not headers, i want to add check when any user import csv file,the script must check header fields must be same as mysql table,otherwise it exit or stop further processing,i just validates the header fields that must be exist same as in my db table, thanks in advance, the script is given below.
$file_handle = fopen("myfile.csv","r")or die("can't open file");
while (($data = fgetcsv($file_handle, 1024, ",")) !== FALSE)
{
$data[0];
$data[1];
$data[2];
$data[3];
$data[4];
$data[5];
$data[6];
$data[7];
$import="INSERT into customer(a_code,c_name,first_name,cell,email,phone,date,group_name) values('$data[0]','$data[1]','$data[2]','$data[3]','$data[4]','$data[5]','$data[6]','$data[7]')";
mysql_query($import) or die(mysql_error());*/
}
fclose($handle);