CodeIgniter provides several methods for executing query results.
See here: https://ellislab.com/codeigniter/user-guide/database/results.html
result() returns an array of PHP objects.
row() returns a single PHP object for this row.
result_array() returns an array of arrays.
row_array() returns a single array for this row.
row() and row_array() do not have to specify a parameter, which is the number of the row you want to return.
Other than that, it's hard to say exactly what you are asking for. You should be able to receive data exactly the way you like using these methods.
Edit
By the way, the way to access these methods is through the request object returned by calling $this->db->get() :
$query = $this->db->get(); $rows = $query->result(); //array of objects $rows_array = $query->result_array(); //array of arrays $row = $query->row(); //single object $row_array = $query->row_array(); //single array
source share