gupster Posted September 11, 2006 Share Posted September 11, 2006 Ive installed some php software and ime getting this error [code]Warning: Invalid argument supplied for foreach() in D:\reactionvision.co.uk\wwwroot\components\com_flickr4j\flickr4j.html.php on line 295[/code]I may be very very wrong but i am using php 5 on my server is it caused that the program was maybe written for php 4. Im not 100% sure but thats my only guess as you can tell i know very little a bout php. Is there a way to fix this?Many thanks,Adam[url=http://www.reactionvision.co.uk]www.reactionvision.co.uk[/url] Quote Link to comment Share on other sites More sharing options...
trq Posted September 11, 2006 Share Posted September 11, 2006 It is not an error on php5's part. its more than likely your code. We need to see some of which before we could possibly help. Quote Link to comment Share on other sites More sharing options...
jefkin Posted September 11, 2006 Share Posted September 11, 2006 I've seen this error many times.It means that the variable you sent to the foreach isn't an array.This can usually be fixed by changing code like[code]if ($myCond){ $myArray = somefunc();}foreach ($myArray as $elem){ // ....}[/code]into code with a preset default for the var (an empty array).[code]$myArray = array();[/code]Trust me on this, that eror only occurs when some path to your foreach doesn't let the variable become an array.Jeff Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.