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

后端 未结 5 2233
萌比男神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:48

    Simple and easy:

    $this->db->order_by("name", "asc");
    $query = $this->db->get($this->table_name);
    return $query->result();
    

提交回复
热议问题