Page 1 of 1

foreach problem

Posted: Thu Nov 30, 2006 9:18 am
by itsmani1
i am having problem with foreach loop. can anyone help me how can fetch items form this array using foreach.

Code: Select all

Array
(
    [0] => Array
        (
            [0] => Array
                (
                    [EVENTNAME] => New York Islanders
                    [CATEGORYID] => 94
                )
            [1] => Array
                (
                    [EVENTNAME] => New Jersey Devils
                    [CATEGORYID] => 94
                )
        )

    [1] => Array
        (
            [0] => Array
                (
                    [EVENTNAME] => Boston Bruins
                    [CATEGORYID] => 95
                )
	)
)

Posted: Thu Nov 30, 2006 9:33 am
by kaszu
You should look at http://uk.php.net/foreach

Code: Select all

foreach($myarray as $group)
{
  foreach($group as $item)
  {
      echo 'Event: '.$item['EVENTNAME'].' CategoryID: '.$item['CATEGORYID'].'<br />';
  }
}