Question

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.

Était-ce utile?

La 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.

Autres conseils

You can use:

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top