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
bennythemink
Forum Newbie
Posts: 16 Joined: Thu Jun 15, 2006 4:32 am
Post
by bennythemink » Fri Aug 18, 2006 5:09 am
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)
{
....
}
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Fri Aug 18, 2006 7:25 am
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 » Fri Aug 18, 2006 7:53 am
sorry, no error message or anything! it just doesnt execute any code after fgetcsv()?
Ambush Commander
DevNet Master
Posts: 3698 Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US
Post
by Ambush Commander » Fri Aug 18, 2006 7:57 am
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 » Fri Aug 18, 2006 8:02 am
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 » Fri Aug 18, 2006 8:22 am
The length parameter only became optional in PHP5.
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Fri Aug 18, 2006 6:24 pm
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)
{
....
}
?>