I'm basically wondering how to get specific rows from a csv file (lets say the file has 5000 rows I want to get the values of the second column from rows 3023 - 3311). Upon obtaining these column values I want to put them into a php array.
What I've tried so far:
$search = $this->uri->segment(3); // get the row number
$row1 = 0;
if (($handle = fopen("Folder/Data.csv", "r")) !== FALSE)
{
while (($data1 = fgetcsv($handle, 1000, ",")) !== FALSE)
{
$num1 = count($data1); // number of data rows
$row1++;
for ($c=0; $c < $num1; $c++) {
echo $data1[$c+1]; // to return second row
}
}
fclose($handle);
But that only returns one single row and I need to return around 200 and put them into an array. Any help is greatly appreciated!