Hi
I have a csv file from which I have to import data into a mysql db. The issue is the csv file has a few top lines with data that I don’t want to import and a few bottom lines I also don’t want to import.
I have the following code which I am currently using to import but I can’t figure out how to just import the lines I want to use.
$handle = fopen($fileDestination,“r”);
while($data = fgetcsv($handle)){
$mycnumber = mysqli_real_escape_string($conn,$data[2]);
$myamount = mysqli_real_escape_string($conn,$data[11]);
$myinstallment = mysqli_real_escape_string($conn,$data[19]);
$mydate = mysqli_real_escape_string($conn,$data[10]);
$sql = “INSERT INTO surecollect_pre_import (cnumber, amount, installment, mydate) VALUES (’”.$mycnumber."’,’".$myamount."’,’".$myinstallment."’,’".$mydate ."’);";
$query=mysqli_query($conn,$sql);
Please help.