我将完成所有工作但不工作。
模型
public function edit(){
$id = $this->uri->segment(3);
$template['page'] = "careerdetails/edit-career";
$template['page_title'] = "Edit Careers Details";
// $template['data'] = $this->career_model->get_careerdetails();
$template['data'] = $this->career_model->show_career_id($id);
$this->load->view('template',$template);
}
public function updatecareer($id,$data){
//$this->db->select('careers');
$this->db->where('id', $id);
$this->db->update('careers', $data);
}
控制器的
public function editcareer(){
$id= $this->input->post('id');
$data = array(
'jobtitle' => $this->input->post('jobtitle'),
'expiriance' => $this->input->post('expiriance'),
'qulification' => $this->inpu- >post('qualifications'),
'gender' => $this->input->post('gender'),
'description' => $this->input->post('description'),
'minsalary' => $this->input->post('minslary'),
'maxsalary' => $this->input->post('maxslary'),
'joblocation' => $this->input->post('joblocation'),
'lastdate' => $this->input->post('lastdate'),
); $this->load->model('career_model');
$this->career_model->updatecareer($id , $data);
redirect(base_url().'careersmgr_ctrl/careers_details');
}
答案 0 :(得分:0)
作为调试的第一步,我将使用
打印查询并查看它是否正确 echo $this->db->last_query();
如果您尝试先设置数据怎么办?
public function updatecareer($id,$data){
$this->db->set($data);
$this->db->where('id', $id);
$this->db->update('careers');
}