0
특정 사용자 레코드를 편집 할 때 오류가 발생하면 모든 사용자 데이터가 자동으로 변경됩니다. 내 코드 :특정 사용자의 codeigniter 값 편집
컨트롤러
public function edit($id){
if (isset($_POST) && !empty($_POST))
{
if ($this->Home->update($id))
{
$this->do_image_upload($id);
$this->session->set_flashdata('message ', 'code already exist , please try with different code');
redirect('Welcome/index1');
}
else
{
$this->session->set_flashdata('message ', 'code already exist , please try with different code');
}
}
$data['client'] = $this->Home->get($id);
$this->load->view('edit ', $data);
}
모델
public function update($id)
{
$id=$_POST['id'];
$data = array(
'invoice' => $this->input->post('invoice'),
);
$this->db->where('id', $id);
$this->db->update('data', $data);
if($this->db->update('data', $data))
{
return true;
}
else
{
return false;
}
}
보기 :