Warning: Invalid argument supplied for foreach()

4 posts by 2 authors in: Forums > CMS Builder
Last Post: February 10, 2009   (RSS)

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

By Dave - February 9, 2009

Hi JH,

Looks like the record doesn't exist. Try adding this code near the top:

$financialRecord = @$financialRecords[0]; // get first record
if (!$financialRecord) {
print "No record found!";
exit;
}


Also, make sure you have created a record in that section.

Let me know if that fixes it for you.
Dave Edis - Senior Developer
interactivetools.com

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

hi Dave

I created the section again.
I add the code.
$financialRecord = @$financialRecords[0]; // get first record [/#666666]
if (!$financialRecord) {
print "No record found!";
exit;
}

I got an error here :
Notice: Undefined variable: financialRecord in /var/www/vhosts/ourdomain/httpdocs/_3.php on line 11 No record found!

Do you know what's problem here?
Please kindly check my code if it could help.

Thanks a lot!

-JH



-Jax H.

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

By Dave - February 10, 2009

Hi JH,

Try adding this (in red):

if (!@$financialRecord) {
print "No record found!";
exit;
}

If that doesn't work feel free to email me CMS and FTP login details to dave@interactivetools.com and I'll take a look for you. (Email, don't post login details to the forum).

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