fgetcsv() only returns half of the rows
| From: | Karen Resplendo | Date: | Fri, 26 Sep 2003 15:46:52 +0000 |
| Subject: | fgetcsv() only returns half of the rows | ||
| Groups: | php.db php.db | ||
| Request: | Send a blank email to php-db+get-30704@lists.php.net to get a copy of this message | ||
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";
}
$buffer = fgets($handle,300);
$buffer = str_replace("\"","",$buffer);
print $buffer."<br>";
} //end of while loop
fclose ($handle);
---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search