In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] says...
> 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.
According to the docs, "A blank line in a CSV file will be returned as an
array comprising a single null field, and will not be treated as an
error." So I imagine you need to apply your validation only where the
array != a single null field.
Cheers
--
Quod subigo farinam
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php