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


object(stdClass)#21 (4) {
  string(1) "1"
  string(8) "Computer"
  string(1) "0"
  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

You dont need the foreach

just use