codeigniter model delete record by id code example
Example: codeigniter delete record by id
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');
}
}
public function delete_record($id){
$deleted = $this->db->delete('mytable', array('id' => $id));
return $deleted;
}