Welcome Guest, Not a member yet? Register   Sign In
getting non-object error only in log file
#10

(09-10-2017, 07:24 PM)ardavan Wrote: Something is wrong!
I just realized it!

even with this activerecord,
PHP Code:
$this->db->get_where($tablename$cond)->result(); 
supposed to get the result in an array, but still is an object
Code:
array(1) { [0]=> object(stdClass)#27 (2) {
this is my output!

Look again. The output is an array, an array with one item. That item is an object. This is exactly what db->result() does - returns an array of objects. One object per row retrieved.

(09-10-2017, 07:24 PM)ardavan Wrote: even if I change the result type to
PHP Code:
$this->db->get_where($tablename$cond)->result_array(); 
i get nested array!
Code:
array(1) { [0]=> array(2) {

This is exactly what db->result_array() is supposed to do. You get an array of arrays. Each sub array is a record (row) from the db.
Reply


Messages In This Thread
RE: getting non-object error only in log file - by dave friend - 09-12-2017, 06:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB