Extra blank lines bomb fgetcsv function

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

 



Here is the beginning of a big loop that loads a line at a time from an uploaded textfile and then runs validation on each field:
 
////////////////////////////////////////////////////////////////////////
//loop through the rows putting the fields into an array
////////////////////////////////////////////////////////////////////////
while ($fieldarray = fgetcsv ($handle, $userfile_size, ",")) {
 
 
The problem I am having is that when there is an empty line at the bottom of the txt file, my validation tells me it is a bad line, and rejects the file. Is there anyway of stopping the loop, or trimming the file of empty lines? Hope I've explained my problem correctly.
 
 


---------------------------------
Do you Yahoo!?
Free Pop-Up Blocker - Get it now

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux