codeigniter delete record by id

PHP
//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;
}
Source

Also in PHP: