Working user manage page with codeigniter, I made edit user function my self and that works but notification can't working. Mean If problem in updating user detail that should through error or Success but nothing happening but datas are updating.
Here is Model(Admin_model.php):
public function editUser($id, $data)
{
$this->db->where('id', $id);
$this->db->update('users', $data);
}
controller(Admin.php):
public function edit_user($id)
{
//set validation rules
$this->form_validation->set_rules('firstname', 'First Name', 'trim|required');
$this->form_validation->set_rules('lastname', 'Last Name', 'trim|required');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('default/admin/edit_user');
} else {
$data = array(
'firstname' => $this->input->post('firstname'),
'lastname' => $this->input->post('lastname'),
'email' => $this->input->post('email'),
'updated_at' => date('Y-m-j H:i:s')
);
if($this->Admin_model->editUser($id,$data)) {
$this->session->set_flashdata('global_alert','<div class="alert alert-success text-center">User updated!</div>');
redirect('admin/users');
} else {
$this->load->view('default/admin/edit_user');
$this->session->set_flashdata('global_alert','<div class="alert alert-danger text-center">Something wrong!</div>');
}
}
}