Search code examples
phpfuelphp

How can I use DB::select() result as object in my views?


So this is working:

DB::select()->from('images')->execute()->as_array();

But I don't like arrays in my views (2 extra letters) I want to use the object. How can I do that?

DB::select()->from('images')->as_object()->execute();

This is giving an error.


Solution

  • Aside from my comment on the original question, any query that's executed will return a Database_Result object that can be foreached and should return stdClass objects for each row.