How to add an ORDER BY clause using CodeIgniter's Active Record methods?

后端 未结 5 2221
萌比男神i
萌比男神i 2020-11-29 02:32

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->         


        
5条回答
  •  攒了一身酷
    2020-11-29 02:47

    Using this code to multiple order by in single query.

    $this->db->from($this->table_name);
    $this->db->order_by("column1 asc,column2 desc");
    $query = $this->db->get(); 
    return $query->result();
    

提交回复
热议问题