Welcome Guest, Not a member yet? Register   Sign In
passing id to link?
#1

[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"; ?>


Messages In This Thread
passing id to link? - by El Forum - 10-22-2008, 10:34 AM
passing id to link? - by El Forum - 10-22-2008, 10:46 AM
passing id to link? - by El Forum - 10-22-2008, 11:01 AM
passing id to link? - by El Forum - 10-22-2008, 05:32 PM
passing id to link? - by El Forum - 10-23-2008, 03:11 AM
passing id to link? - by El Forum - 10-23-2008, 07:44 AM
passing id to link? - by El Forum - 10-23-2008, 10:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB