FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » fgetcsv -- No error reporting?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
fgetcsv -- No error reporting? [message #172810] Thu, 03 March 2011 16:30 Go to previous message
matt[1] is currently offline  matt[1]
Messages: 40
Registered: September 2010
Karma:
Member
Hi all,

Trying to process a fairly large csv file, and it's bombing out early on me.. This quick test script describes the problem:

# cat test.php
<?php

ini_set("display_errors", true);
error_reporting(E_ALL | E_STRICT);

$file = "my.csv";
$fHandle = fopen($file, "r");

$rowNum = 0;
while (fgetcsv($fHandle)) ++$rowNum;

printf ("Lines: %d\nLastRow: %d\n", count(file($file)), $rowNum);

# php test.php
Lines: 329360
LastRow: 328141


There are no multi-line entries in the file, so it seems to be legitimately returning false for some reason about 1200 lines early. A visual inspection of the file around line 328,141 doesn't reveal any errors, and no errors are being triggered from PHP/fgetcsv.

Any ideas on how to diagnose what's going on here?

Thanks,
Matt
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: String Question
Next Topic: copy data from one table to another table
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 15:01:11 GMT 2024

Total time taken to generate the page: 0.04133 seconds