Codeigniter Order By Query – We often need to add the order by clause on queries. It is very simple to use order by clause on CodeIgniter query. Here in this article we are going to explain how to add order by on Active records.
Codeigniter Order By Query ASC | DESC Example
You can add order by filter simly as below-
Codeigniter Order By Query Example:
$this->db->from('my_table'); $this->db->order_by("column1 asc,column2 desc"); $query = $this->db->get(); return $query->result(); |
You can add multiple filers separated by comma(,).