You are using $this->db->insert()
, but with Active Record to update the row you should be using $this->db->update()
$data = array(
'title' => $title,
'name' => $name,
'date' => $date
);
$this->db->where('id', $id);
$this->db->update('mytable', $data);
Another words your functions should look like this:
public function update_job_contract($post_obj)
{
$id = $post_obj['id'];
$data = array
(
'client_feedback' => $post_obj['client_feedback'],
'client_notetoself' => $post_obj['client_notetoself'],
'contract_status' => $post_obj['contract_status'],
'client_id' => $this->auth_model->get_user_id()
);
$this->db->where('id', $id);
$this->db->update('job', $data);
}
public function provider_update_job_contract($post_obj)
{
$id = $post_obj['id'];
$data = array
(
'provider_feedback' => $post_obj['provider_feedback'],
'provider_notetoself' => $post_obj['provider_notetoself'],
'provider_id' => $this->auth_model->get_user_id()
);
$this->db->where('id', $id);
$this->db->update('job', $data);
}
Also, inside the controllers $_POST should be replaced with $this->input->post()
Using this one as example:
public function provider_update_job_contract_submit()
{
$this->validateRole('provider');
$this->load->model('job_model');
$post = $this->input->post();
if ( '0' == $post['id'] )
{
$this->job_model->provider_update_job_contract($post);
}
redirect('provider/job_contracts?message=Congratulations!');
}
Make sure you update other controllers in the same way