I am trying to send CSV data into my mysql database but i want to skip first row of the data because it contains header, i went through some post in here but they were not helpfully any idea how can i perform this in my below codes?????
//if ($_FILES['csv']['size'] > 0) {
if (!empty($_FILES['csv']['size']) && $_FILES['csv']['size'] > 0) {
//get the csv file
$file = $_FILES['csv']['tmp_name'];
$handle = fopen($file,"r");
//loop through the csv file and insert into database
$num = count($data);
do {
if ($data[0]) {
mysql_query("INSERT INTO mbet_football (TIME, TEAMS, HOME, DRAW, AWAY) VALUES
(
'".addslashes($data[0])."',
'".addslashes($data[1])."',
'".addslashes($data[2])."',
'".addslashes($data[3])."',
'".addslashes($data[4])."'
)
");
}
} while ($data = fgetcsv($handle,1000,",","'"));
//
//redirect
header('Location: mbetf.php?success=1'); die;
}
?>