Jump to content

[SOLVED] fgetcsv drop first line


Comdemned

Recommended Posts

Hi people.

 

I am having a problem figuring out how to drop the first like returned using fgetcsv.

<?php
while (($line = fgetcsv($fp, 1024, ",")) !== FALSE){

}
?>

I need to drop the first line only from the csv file and display the rest.

I have searched the forums and google and thus far come up short on finding out how to drop the first line.

any help would be greatly appreciated.

 

Thanks

Murray

Link to comment
https://forums.phpfreaks.com/topic/74049-solved-fgetcsv-drop-first-line/
Share on other sites

<?php
$first = true;
while (($line = fgetcsv($fp, 1024, ",")) !== FALSE){
	if ($first) {
                     $first = false;
                     continue;
                     }

                // process csv data
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.