Hi Guys

i am developing a system in php using codeigniter framework, in this i retrived result from database

it stored in an variable and its var_dump result is like

var_dump($cat_data)

object(stdClass)#21 (4) {
  ["id"]=>
  string(1) "1"
  ["name"]=>
  string(8) "Computer"
  ["image"]=>
  string(1) "0"
  ["p_cat"]=>
  string(1) "0"
  }

when i try to fetch data from this using foreach loop with this coding

  foreach ($cat_data as $row_cat )
{

    echo $row_cat->id;

}

i gives message "Message: Trying to get property of non-object"

and when i try to use it like

echo $row_cat['id'] is says

Message: Illegal string offset 'id'

can somebody help me please i am confused