Re: fgetcsv doesn't return an array?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jay Blanchard wrote:
154     $csvCurrentLine = fgetcsv($csvFile, 4096, ',');
155     $currentLine = implode(",", $csvCurrentLine);

I am using it in a loop. End Of File is an error?

You certainly need to break out on $csvCurrentLine = false which indicates end of file at least.

My own 'loop' is
$row=0;
while (($data = fgetcsv($handle, 800, ",")) !== FALSE) {
  if ( $row ) $contact->RecordLoad( $data, $row );
    	$row++;
}
The row bit strips the header line from the csv file ...

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux