I have a very small script to get all records from a database table, the code is below.
$query = $this->db->get($this->table_name); return $query->
Just add the'order_by' clause to your code and modify it to look just like the one below.
$this->db->order_by('name', 'asc'); $result = $this->db->get($table);
There you go.