Warning: Invalid argument supplied for foreach()

7 posts by 2 authors in: Forums > CMS Builder
Last Post: January 16, 2009   (RSS)

I've just onto a vps and whenever I try to use the code given in CMS, it doesn't show up, and I get the following error wher an image should be:

Warning: Invalid argument supplied for foreach() in /home/moonworksuk/ackatt/test2.php on line 47

Anybody have any ideas?

Thanks,

joe
High quality residential training for writers, actors & Film Making - Click Here for further information

Re: [Moonworks] Warning: Invalid argument supplied for foreach()

By Dave - January 16, 2009

Hi Joe,

That error means the variable in the foreach isn't defined. So if you had ...foreach ($record['uploads']... then maybe uploads isn't defined.

Can you attach your viewer file to this thread so we can see the code?

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Moonworks] Warning: Invalid argument supplied for foreach()

By Dave - January 16, 2009

Hi Moonworks,

Are there any records created in that section? And are any of the other fields showing their content from the database?

Let me know. Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Warning: Invalid argument supplied for foreach()

Adding info would have helped I suppose. My excuse is that it was 4am when I noticed the problem. Maybe I should have checked again before asking [:/]
High quality residential training for writers, actors & Film Making - Click Here for further information

Re: [Moonworks] Warning: Invalid argument supplied for foreach()

By Dave - January 16, 2009

Is it working now? :) If the problem was that no records were created yet you can also add some code to display a message that says that "No records" instead of the error if it might happen again.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Warning: Invalid argument supplied for foreach()

all sorted, thanks
High quality residential training for writers, actors & Film Making - Click Here for further information