On 03/15/2012 10:09 AM, Jay Blanchard wrote:
I thought that fgetcsv returned an array. I can work with it like an
array but I get the following warning when using it

|Warning: implode(): Invalid arguments passed on line 155

154 $csvCurrentLine = fgetcsv($csvFile, 4096, ',');
155 $currentLine = implode(",", $csvCurrentLine);
|

Everything that I have read online indicates that it is because
$csvCurrentLine is not declared as an array. Adding a line to the code

153 |$csvCurrentLine = array();

Does not get rid of the warning. The warning isn't interfering with the
script working, but it us annoying. Does anyone know the solution?

Thanks!

Jay
|


From the manual

"fgetcsv() returns NULL if an invalid handle is supplied or FALSE on other errors, including end of file."

do this

154 $csvCurrentLine = fgetcsv($csvFile, 4096, ',');
var_dump($csvCurrentLine);
155 $currentLine = implode(",", $csvCurrentLine);

What does it say about the variable from the failing line?

--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/

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

Reply via email to