Welcome Guest, Not a member yet? Register   Sign In
How can I dynamically get the ID from a row in my database?
#1

[eluser]cvandal[/eluser]
Hello,

Can someone please explain to me how I can dynamically get the ID from a row in my database rather than the hardcode method I have below?

I've tried, '$this->db->where('id', $this->uri->segment(3));' but nothing happens. I don't get any errors either.

The Model:
Code:
function update_entry($data)
    {
        $this->db->where('id', 103);
        $this->db->update('pages', $data);
    }

The Controller:
Code:
function update_page()
    {
        $data = array(
            'title' => $this->input->post('title'),
            'content' => $this->input->post('content')
        );
        $this->crud_model->update_entry($data);
        $this->index();
    }


Messages In This Thread
How can I dynamically get the ID from a row in my database? - by El Forum - 09-12-2009, 07:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB