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: > http://us3.php.net/manual/en/function.fgetcsv.php > > $uploadthis = 'C:/AsciiTestJohn/OR100012-09252003.txt'; > $row = 1; > $handle = fopen ($uploadthis,"r"); > rewind($handle); > while ($fieldarray = fgetcsv ($handle, 300, ",")) { > $fieldcount = count ($fieldarray); > print "<p> $fieldcount fields in line $row: <br>\n"; > $row++; > for ($c=0; $c < $fieldcount; $c++) { > print $fieldarray[$c] . "<br>\n"; > } 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."<br>"; > } //end of while loop > > fclose ($handle); -- 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 ------------------------------------------ /* ...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 (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php