activerecord - CodeIgniter: Returning data as an object vs array -
there functions return data either object:
$query = $this->db->query("your query"); if ($query->num_rows() > 0) { foreach ($query->result() $row) { echo $row->title; echo $row->name; echo $row->body; } }
or array:
$query = $this->db->query("your query"); foreach ($query->result_array() $row) { echo $row['title']; echo $row['name']; echo $row['body']; }
i've returned data arrays, when case returning "object" preferable?
performance. array better object.
Comments
Post a Comment