Welcome Guest, Not a member yet? Register   Sign In
A little help with my first app...
#8

[eluser]invision[/eluser]
I had thought of starting a new thread, but would prefer to keep this open for a bit.

If I wanted to make a model/view/controller for deleting an entry from my 'data' table, how would I best do this?

I'd thought of this....

controller:
Code:
function delete()
    {
        $this->load->model('Guestbook_model');
          $this->Guestbook_model->deleteEntry($id);
        $this->load->view('delete_success');
    }

model:
Code:
function deleteEntry(){
        $this->db->query("DELETE FROM data");
        $this->db->where('id',$this->uri_segment('3'));        
    }

Does this look about right? I've a feeling it's not Sad

The idea being that they visit ... example.com/guestbook/index.php/delete/2 and it would remove that entry from my table, and return the user to the guestbook.


Many thanks for any pointers with this.


Messages In This Thread
A little help with my first app... - by El Forum - 02-18-2010, 09:58 AM
A little help with my first app... - by El Forum - 02-18-2010, 10:20 AM
A little help with my first app... - by El Forum - 02-18-2010, 10:48 AM
A little help with my first app... - by El Forum - 02-18-2010, 10:51 AM
A little help with my first app... - by El Forum - 02-18-2010, 10:55 AM
A little help with my first app... - by El Forum - 02-18-2010, 11:04 AM
A little help with my first app... - by El Forum - 02-18-2010, 11:43 AM
A little help with my first app... - by El Forum - 02-20-2010, 02:14 PM
A little help with my first app... - by El Forum - 02-20-2010, 03:50 PM
A little help with my first app... - by El Forum - 02-21-2010, 12:45 AM
A little help with my first app... - by El Forum - 02-22-2010, 04:30 AM
A little help with my first app... - by El Forum - 02-22-2010, 09:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB