1$this->db->from($this->table_name);
2$this->db->order_by("name", "asc");
3$query = $this->db->get();
4return $query->result();
1$this->db->select('ae_users.employee_id, ae_users.emp_name, ae_users.emp_name2, ae_users.emp_name3');
2 $this->db->from('ae_users');
3 $this->db->where_in('ae_users.employee_id',$employee_ids);
4
5 $query =$this->db->get();
6
7 if ($query->num_rows()) {
8 return $query->result_array();
9 } else {
10 return 0;
11 }
1$this->db->select('ae_users.employee_id, ae_users.emp_name, ae_users.emp_name2, ae_users.emp_name3');
2 $this->db->from('ae_users');
3 $this->db->where_in('ae_users.employee_id',$employee_ids);
4 $this->db->_protect_identifiers = FALSE; // stop CI adding backticks
5 $order = sprintf('FIELD(ae_users.employee_id, %s)', implode(', ', $employee_ids));
6 $this->db->order_by($order);
7 $this->db->_protect_identifiers = TRUE;
8 $query =$this->db->get();
9 // echo '<pre>'; print_r($this->db->last_query());exit;
10 if ($query->num_rows()) {
11 return $query->result_array();
12 } else {
13 return 0;
14 }