What I am trying to do:
lab uploads txt file
php validates file, row by row, field by field (against database)
I display bad rows and reasons in red and reject file
 
I've figured out a different way to display the whole row by just printing the array 
with "," instead of "<br>/n"
 
Just wondering why the row pointer was getting incremented and now I think I know why:
a call to both fgetcsv() and fget() will each increment the row pointer by one. No?
 
So, taking this out leaves only fgetcsv() to increment the rows in the text file it is 
looking at:
 
 /*$buffer = fgets($handle,300);
 $buffer = str_replace("\"","",$buffer);
    print $buffer."<br>";*/
 
Warning: more on this later  :)
 


Jason Wong <[EMAIL PROTECTED]> wrote:
On Saturday 27 September 2003 01:24, Karen Resplendo wrote:
> Does that mean that my length setting has to be exactly the length of the
> row? 

No.

> I don't know this because it is a comma delimited file, not a space
> delimited. The function description says:
>
> "The length parameter must be greater than the longest line to be found in
> the CSV file (allowing for trailing line-end characters). "

So set it to [max line length]+10.

> I removed this block where I do an fgets() and then I get all rows
> displayed. Also, I was mistaken about total rows. There are 123 and I only
> display 62, which is half, so I'm thinking something is being incremented
> twice instead of once. 

Exactly, that block of code below is reading in another line. What is it's 
purpose anyway? What are you trying to achieve?

> What should I set the length at?:
>
> $buffer = fgets($handle,300);
> $buffer = str_replace("\"","",$buffer);
> print $buffer."
";


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
------------------------------------------
/*
The wise man seeks everything in himself; the ignorant man tries to get
everything from somebody else.
*/

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


---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

Reply via email to