is it possible to insert a csv file into a table and instruct the query to always ignore the first row from the csv file. Users will be uploading files but the first row will be the column headings so I need the query to ignore the first row. My script looks like this at the moment:
<?php
include 'datalogin.php';
move_uploaded_file($_FILES["fileCSV"]["tmp_name"],
"quiz/" . $_FILES["fileCSV"]["name"]);
$objCSV = fopen("quiz/".$_FILES["fileCSV"]["name"], "r");
while (($objArr = fgetcsv($objCSV, 1000, ",")) !== FALSE) {
$strSQL = "INSERT INTO ex_question1 ";
$strSQL .="(id,tn,qnr,qtype,pic,question,option1,option2,option3,option4) ";
$strSQL .="VALUES ";
$strSQL .="('".$objArr[0]."','".$objArr[1]."','".$objArr[2]."','".$objArr[3]."','".$objArr[4]."','".$objArr[5]."','".$objArr[6]."','".$objArr[7]."','".$objArr[8]."','".$objArr[9]."') ";
$objQuery = mysql_query($strSQL);
}
fclose($objCSV);
echo "Import completed.";
?>