Answers for "delete codeigniter"

PHP
0

codeigniter delete record by id

//include this in your controller
public function delete_record($eid){
    $delete = $this->your_model->delete_record($id);
    if ($delete == FALSE) {
      $this->session->set_flashdata('error', 'Employee deletion failed, try again.');
      redirect('your_view', 'refresh');
    } else {
      $this->session->set_flashdata('success', 'Employee deleted successfully.');
      redirect('your_view', 'refresh');
    }

}

//include this in your model
public function delete_record($id){
	$deleted = $this->db->delete('mytable', array('id' => $id));
    return $deleted;
}
Posted by: Guest on February-25-2021

Code answers related to "delete codeigniter"

Browse Popular Code Answers by Language