php - how to use concat function with update in codeigniter? -


code:

if($this->input->post('submit')) {      $data = array(             'admin_id' => $this->input->post('admin'),              );     $this->db->select('*');     $this->db->from('assign_menu_admin');     $query = $this->db->get();     $result = $query->result_array();     foreach ($result $row)      {         $where = "menu_link = '".$row['menu_link']."'";         $this->db->where($where);         $this->db->set('admin_id', "concat(admin_id,',','".$data."')", false);          $query = $this->db->update('assign_menu_admin');         echo $this->db->last_query();     } } 

in code have table having name assign_menu_admin , admin_id name column inside it. now, want use concat function showing admin_id 1,2,3,4 showing error. how can fix error ?please me.

enter image description here

thank you

change line

$this->db->set('admin_id', "concat(admin_id,',','".$data['admin_id']."')", false);  

Comments

Popular posts from this blog

go - serving up pdfs using golang -

python - Best design pattern for collection of objects -

how to add preprocess loader in webpack 2 -