Extra blank lines bomb fgetcsv function
| From: | Karen Resplendo | Date: | Tue, 02 Dec 2003 00:52:17 +0000 |
| Subject: | Extra blank lines bomb fgetcsv function | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-31825@lists.php.net to get a copy of this message | ||
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