Does that mean that my length setting has to be exactly the length of the row? 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). "
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. What should I set 
the length at?:
$buffer = fgets($handle,300);
 $buffer = str_replace("\"","",$buffer);
    print $buffer."<br>";

Jason Wong <[EMAIL PROTECTED]> wrote:
On Friday 26 September 2003 23:46, Karen Resplendo wrote:
> There are 113 rows in my comma delimited text file and the code below only
> displays 62 of them. It executes very quickly so I'm not thinking there is
> a time out problem. Any ideas?
> //here is URL with fgetcsv() explanation:
> $uploadthis = 'C:/AsciiTestJohn/OR100012-09252003.txt';
> $row = 1;
> $handle = fopen ($uploadthis,"r");
> rewind($handle);
> while ($fieldarray = fgetcsv ($handle, 300, ",")) {
> $fieldcount = count ($fieldarray);
> print "
$fieldcount fields in line $row: 
> $row++;
> for ($c=0; $c < $fieldcount; $c++) {
> print $fieldarray[$c] . "
> }

Your logic here seems a bit odd. In your WHILE clause you're reading chunks of 
300 chars at a time. Then in the code below, you're reading in another chunk 
of 300 chars. Thus each iteration of the WHILE-loop reads in 600 chars from 
the file. Is that your real intention?

> $buffer = fgets($handle,300);
> $buffer = str_replace("\"","",$buffer);
> print $buffer."
> } //end of while loop
> fclose ($handle);

Jason Wong -> Gremlins Associates ->
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
Search the list archives before you post
...there can be no public or private virtue unless the foundation of action is
the practice of truth.
- George Jacob Holyoake

PHP Database Mailing List (
To unsubscribe, visit:

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

Reply via email to