For some reason I cannot for the life of me get the edit page to display. Not sure what I am doing wrong I went through the code so many times. When I click to edit a record the page is blank and no error messages come up.
here is the code for the model which I think is why it is causing an issue.
public function update_employee($data,$id)
{
$this->db->where('id',$id);
$this->db->update('employee_list',$data);
return ($this->db->affected_rows() != 1 ) ? false:true;
}
}
Here is the code for the contoller
public function update_employee()
{
$id=$this->input->post('id');
$data=array('Employee_Name'=>$this->input->post('Employee_Name'),
'Employee_Number'=>$this->input->post('Employee_Number'));
$result=$this->employee_model->update_employee($data);
if($result > 0)
{
$this->session->set_flashdata('msg',"Employee Records Updated Successfully");
redirect('employee/list_employees');
}
else
{
$this->session->set_flashdata('msg1',"No changes Made in Employee Records");
redirect('employee/list_employees');
}
}
I replaced return ($this->db->affected_rows() != 1 ) ? false:true;
with return print_r($data);
and now it works