Jump to content


Photo

error with foreach() and multidimentional array FIXED


  • Please log in to reply
No replies to this topic

#1 leeming

leeming
  • Members
  • PipPipPip
  • Advanced Member
  • 93 posts

Posted 24 August 2006 - 03:22 PM

FIXED
solution : the multidimentional array was empty (no POST calls)



I am getting this error...

Warning: Invalid argument supplied for foreach() in...


for this code..

foreach($requestArr AS $request)
{   //for each POST, GET
  foreach($request AS $varName) //this line
  {
      ....
  }
}

$requesrArr is basicly _GET and _POST put together as a multi array..

array
(
  [POST] => array(),
  [GET] => array()
)


i dont understand why im getting this error, as i normaly only appears if the array doesnt exist.. but it does, i have even checked it with print_r()

Array
(
  [POST] => Array (
                            [0] => 0
                        )
  [GET] =>  Array (
                            [0] => 0
                            [1] => into
                            [2] => auto
                            [3] => debug
                          )
  [0] =>
)



oh and as a side note.. how can i get rid of the '0' key... as i only define 'POST' and 'GET' as keys
Im not perfect ;) lol




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users