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$names = array('Frank', 'Todd', 'James');
2$this->db->where_not_in('username', $names);
3// Produces: WHERE username NOT IN ('Frank', 'Todd', 'James')
4
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 }
1$this->db->set('name', $name);
2$this->db->set('title', $title);
3$this->db->set('status', $status);
4$this->db->insert('mytable');
5
1$builder->select('title, content, date');
2$query = $builder->get();
3
4// Executes: SELECT title, content, date FROM mytable
5