1$data = array(
2 'title' => $title,
3 'name' => $name,
4 'date' => $date
5);
6
7$this->db->where('id', $id);
8$this->db->update('mytable', $data);
9// Produces:
10//
11// UPDATE mytable
12// SET title = '{$title}', name = '{$name}', date = '{$date}'
13// WHERE id = $id
14
1public function update_row(){
2
3 $update_rows = array('field-name' => 'field-data',);
4 $this->db->where('id', 1 );
5 $this->db->update('table-name', $update_rows);
6
7 }
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 }
1public function update_row(){
2
3 $update_rows = array(
4 'name' => 'rincky',
5 'address' => 'India',
6 'contact' => '98545785',
7 'department' => 'IT',
8
9 );
10 $this->db->where('id', 1 );
11 $result = $this->db->update('user', $update_rows);
12 return $result;
13 }
1$data = array(
2 'title' => $title,
3 'name' => $name,
4 'date' => $date
5);
6
7$this->db->where('id', $id);
8$this->db->update('mytable', $data);