php version question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bennythemink
Forum Newbie
Posts: 16
Joined: Thu Jun 15, 2006 4:32 am

php version question

Post 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)
{
    ....
}
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

bennythemink wrote:for some reason the method fgetcsv() doesnt work
"doesnt work" is too vage.
What's the error message?
bennythemink
Forum Newbie
Posts: 16
Joined: Thu Jun 15, 2006 4:32 am

Post by bennythemink »

sorry, no error message or anything! it just doesnt execute any code after fgetcsv()?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Try putting error_reporting(E_ALL); at the top of your script. Also, you ought to use !==, not !=.
bennythemink
Forum Newbie
Posts: 16
Joined: Thu Jun 15, 2006 4:32 am

Post by bennythemink »

did that but still not getting an error message and the code after that fgetcsv() is still not being run?!
jamiel
Forum Contributor
Posts: 276
Joined: Wed Feb 22, 2006 5:17 am
Location: London, United Kingdom

Post by jamiel »

The length parameter only became optional in PHP5.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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)
{
    ....
} 
?>
Post Reply