|
Posted by "Mark Steudel" on 12/20/05 04:18
Something that I use to make sure I don't give the user a nicer error
If ( is_array( $array ) )
{
foreach ( $array as $key => $value )
{
echo
}
}
Else
{
exit('Expecting array')
}
-----Original Message-----
From: David Robley [mailto:robleyd@ozemail.com.au]
Sent: Monday, December 19, 2005 5:21 PM
To: php-general@lists.php.net
Subject: [PHP] Re: Invalid argument supplied for foreach()
Jose Borquez wrote:
> I am getting the following errors when accessing a php page:
>
> /usr/local/www/groupoffice-com-2.14-FINAL-4/configuration/index.php(29
> 9)
> : Warni
> ng - Invalid argument supplied for foreach() [Mon Dec 19 15:10:52
> 2005] [error] PHP Warning: Invalid argument supplied for f
> oreach() in
> /usr/local/www/groupoffice-com-2.14-FINAL-4/configuration/index.php
> on line 299
>
> I solved previous php error problem by installing the php5-extensions,
> but now I am getting the following errors in my log files and I have
> no idea what it could be. Any help would be greatly appreciated.
>
> Thanks in advance,
> Jose
foreach expects to have an array passed as its argument; the error message
suggests that what it is receiving is not an array. Without seeing your
code, the only suggestion we could make (well, me anyway) is to check what
is actually being passed, with print_r or var_dump.
Cheers
--
David Robley
Support bacteria - it's the only culture some people have!
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
Navigation:
[Reply to this message]
|