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->like('title', 'match'); $this->db->or_like('body', $match);
2// WHERE `title` LIKE '%match%' ESCAPE '!' OR `body` LIKE '%match%' ESCAPE '!'
3
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
1$table = "my_table";
2$id = 1;
3$update = ["status"=>"working"];
4//Edit just above /\ if you don't need extra "where" clause
5$query = $this->db->select()
6 ->from($table)
7 ->where('id', $id)
8 ->get_compiled_select();
9$data = $this->db->query("$query FOR UPDATE")->row_array();
10$this->db->where('id', $data['id'])->update($table,$update);