Edwin Nick
Edwin Nick

Reputation: 39

ORDER BY In Codeigniter

public function mandarin_2($limit = '', $offset = '')
    {
        $data['aktivisdcm1'] = $this->db->get_where('tb_imam', array('status' => 'Aktivis'))->result_array();

    $data['title'] = 'Absensi Mandarin 2';
    $this->load->view('absensi/mandarin_2', $data);
    $this->load->view('templates/header');
    // $this->load->view('templates/footer');
}

please help .. how do I make an order by my coding? thank you, I really hope the response

Upvotes: 0

Views: 666

Answers (2)

Edwin Nick
Edwin Nick

Reputation: 39

I try this to solve:

$data['aktivisdcm1'] = $this->db->order_by("nama", "asc")-> get_where('tb_imam', array('status' => 'Aktivis'))->result_array(); 

Upvotes: 1

Carljul
Carljul

Reputation: 111

You can check their documentation right here for their ordering results. This is how they do it.

$this->db->order_by('title', 'DESC');
// Produces: ORDER BY `title` DESC

CodeIgniter Documentation Query Builder Class Ordering Results

Upvotes: 1

Related Questions