For example I have data:
File generated by system automatically...
9 rows selected.
Heber,Camrynborough,26728,Home Health Aide
Modesto,West Janet,15152-2683,Software Engineer
Dante,East Chanel,74689-6886,Entertainment Attendant
Nolan,Murphyville,32561-8079,Credit Authorizer
Jovany,O'Reillyton,44371,Medical Assistant
Jaeden,Greenfort,06179-1759,School Social Worker
Efrain,West Blairborough,11282-0496,Electronic Drafter
Travon,South Tatum,76603-0822,Manufactured Building Installer
Agustina,North Gertrudeland,18950,Health Services Manager
and simple php code to import data into mysql
$open = fopen('employee-data.txt','r');
while (!feof($open))
{
$getTextLine = fgets($open);
$explodeLine = explode(",",$getTextLine);
list($name,$city,$postcode,$job_title) = $explodeLine;
$qry = "insert into empoyee_details (name, city,postcode,job_title) values('".$name."','".$city."','".$postcode."','".$job_title."')";
mysqli_query($conn,$qry);
}
fclose($open);
It works fine, but problem is on start read file, because file contains three useless lines (two with text and last one is empty). How can I delete lines before start import data into mysql?