1$this->db->group_by(array("title", "date"));
2// Produces: GROUP BY title, date
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$data = array(
2 'title' => 'My title',
3 'name' => 'My Name',
4 'date' => 'My date'
5);
6
7$this->db->insert('mytable', $data);
8// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date')
1$this->db->select('*')->from('my_table')
2 ->group_start()
3 ->where('a', 'a')
4 ->or_group_start()
5 ->where('b', 'b')
6 ->where('c', 'c')
7 ->group_end()
8 ->group_end()
9 ->where('d', 'd')
10->get();
11
12// Generates:
13// SELECT * FROM (`my_table`) WHERE ( `a` = 'a' OR ( `b` = 'b' AND `c` = 'c' ) ) AND `d` = 'd'
14