0

I have written PHP code to get values from a CSV file, containing my netflix viewing history, so that I may put into a database. My code is:

<?php /* The idea will put my Netflix viewing history into a database */
$history     = fopen("netflix.csv", "r");
while($row    = fgetcsv($history, 1000, ","))
{
    $title = explode(":", $row[0])[0];
    $watch = explode("/", $row[1]);
    echo "I watched {$title} on {$watch[2]}-{$watch[1]}-{$watch[0]}<br>";
}
print_r($items);
?>

The reason I am using a while loop is to loop over each line in the CSV file but, when I echo it out to see what I get, I find that I am getting the first line. How do I go about removing the first line?

Will
  • 5
  • 1

1 Answers1

0

Call fgetcsv one more time before the loop starts.

Evert
  • 93,428
  • 18
  • 118
  • 189