Need to add an extra line to skip the first line with headers on csv file. but i dont know from where to start.
<?php
if(isset($_POST["submit"]))
{
$host="localhost"; // Host name.
$db_user="root"; //mysql user
$db_password=""; //mysql pass
$db='local'; // Database name.
$conn=mysql_connect($host,$db_user,$db_password) or die (mysql_error());
mysql_select_db($db) or die (mysql_error());
echo $filename=$_FILES["file"]["name"];
$ext=substr($filename,strrpos($filename,"."),(strlen($filename)-strrpos($filename,".")));
  $file = fopen($filename, "r");
    $handle = fopen("$filename", "r");
    while (($data = fgetcsv($handle, 100000, ",")) !== FALSE)
    {
    $import="INSERT into customers(fname,lname,company,address,city,state,country,postal_code,phone,email) values('$data[0]','$data[1]','$data[2]','$data[3]','$data[4]','$data[5]','$data[6]','$data[7]','$data[8]','$data[9]')";
    mysql_query($import) or die(mysql_error());
    }
    fclose($handle);
    print "Import done";
    }
    else
    {
    print "<form enctype='multipart/form-data' method='post'>";
    print "Type file name to import:";
    print "<input type='file' name='file' id='file'>";
    print "<input type='submit' name='submit' value='submit'></form>";
    }
?>
Any help is apreciated.
 
     
     
     
    