[eluser]slothdog[/eluser]
I want to delete an entry from the database by its id number. Ive got the model to do the delete working when I manually edit the function and put in the number for the id to delete.
for example:
#1 BLHABLH edit | delete
how do i get the id #1 into the link to tell the delete function what to delete?
thanks.
model:
Code:
function delete_by_pkey($idField)
{
// LOAD DATABASE
$this->load->database();
// SELECT
$this->db->where('id', $idField);
// DO THE DELETE
$this->db->delete('registration');
return true;
}
excerpt from controller:
Code:
function deletecollective()
{
// LOAD DATABASE MODEL
$this->load->model('registrationmodel');
// QUERY MODEL
$data['query'] = $this->registrationmodel->delete_by_pkey(HERE IS WHERE I NEED TO GET THE ID#);
// DISPLAY DATA
$this->load->view('viewdeletecollective');
}
view:
Code:
<? echo "Deleted"; ?>