I am trying to find a quick way of reading from a csv file, by first skipping a number of lines, reading about 20 lines, then stopping the read. the only solution right now is u
Let's say if you have this piece of code below
"; // OPEN ROW
if(strpos($data[$c], 'Finished') !== false) {
$c++;
echo "" . $data[$c] . " ";
}else{
echo "" . $data[$c] . " ";
}
echo ""; // CLOSE ROW
}
}
fclose($handle);
}
?>
if you add
if($row == 20){ $row++; continue; }
after the while loop
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
if($row == 20){ $row++; continue; }
now, let's say if you want to start from row 20, it would continue reading
let's take another example. if you want to stop reading at line 40 starting from 1 you can insert
if($row == 40){ $row++; exit; }