I wanted to get recent records from database limit only to 5. I used the code below but not working. Maybe I missed something or the whole query is wrong. Please guide me. Thanks
Model
public function get_comments ($id) {
$this->db->select('*');
$this->db->order_by('id', 'ASC');
$this->db->from('Item_comments');
$this->db->limit('5');
$this->db->where(array('checklist_item_id' => $id, 'status' => 1));
$query = $this->db->get();
return $query->result_array();
}
Note: query works fine and get 5 records from db but I want to position the recent into the bottom. Thanks