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.

有帮助吗?

解决方案

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.

其他提示

You can use:

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top