Page 1 of 1

php version question

Posted: Fri Aug 18, 2006 5:09 am
by bennythemink
hi guys,

for some reason the method fgetcsv() doesnt work even though im using php version 4.3.11? it was implemented in verison 3.0.8

i have the same code on a platform running php version 5.1.2 and it works on that?!!!


anyone have any ideas?

many thanks for any help.

benny

heres the code in case your interested:

Code: Select all

$handle = fopen("sku1.csv","r");

while(($data = fgetcsv($handle,"",",")) != false)
{
    ....
}

Posted: Fri Aug 18, 2006 7:25 am
by volka
bennythemink wrote:for some reason the method fgetcsv() doesnt work
"doesnt work" is too vage.
What's the error message?

Posted: Fri Aug 18, 2006 7:53 am
by bennythemink
sorry, no error message or anything! it just doesnt execute any code after fgetcsv()?

Posted: Fri Aug 18, 2006 7:57 am
by Ambush Commander
Try putting error_reporting(E_ALL); at the top of your script. Also, you ought to use !==, not !=.

Posted: Fri Aug 18, 2006 8:02 am
by bennythemink
did that but still not getting an error message and the code after that fgetcsv() is still not being run?!

Posted: Fri Aug 18, 2006 8:22 am
by jamiel
The length parameter only became optional in PHP5.

Posted: Fri Aug 18, 2006 6:24 pm
by RobertGonzalez
I like jamiel's answer, but I would also try this to see what is happening...

Code: Select all

<?php
$handle = fopen("sku1.csv","r");
$data = fgetcsv($handle,"",",");
print_r($data);

while(($data) !== false)
{
    ....
} 
?>