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->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('*');
2$this->db->from('table1');
3$this->db->join('table2', 'table1.id = table2.id');
4$this->db->join('table3', 'table1.id = table3.id');
5$query = $this->db->get();
6
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);