Jump to content

foreach() error is php5 causing this?


gupster

Recommended Posts

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]
Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.