2012-03-21 2 views
2

나는 이것이 간단하다는 것을 알고 있지만 그것을 완성하지 못했다.codeigniter에서 order-by을 어떻게 사용할 수 있습니까?

$query = $this->db->get_where('prepared_forms', array('topic' => $this->input- >post('prepared_topics'))); 
$new_form = $query->row_array(); 

준비된 양식은 주제 이름 (ASC)으로 어떻게 주문할 수 있습니까?

답변

3
$this->db->select("*") 
    ->from('prepared_forms') 
    ->where('topic', $this->input->post('prepared_topics')) 
    ->order_by('topic', 'asc') 
    ->get() 
    ->result_array(); 
2
$this->db->order_by("topic", "asc"); 
$query = $this->db->get_where('prepared_forms', array('topic' => $this->input->post('prepared_topics'))); 
$new_form = $query->row_array(); 
4

이 시도 :

$query = $this->db->order_by('topic', 'asc')->get_where('prepared_forms', array('topic' => $this->input->post('prepared_topics'))); 
$new_form = $query->row_array(); 
관련 문제