Welcome Guest, Not a member yet? Register   Sign In
Update function does not work - Beginner problem
#2

[eluser]Wondering Coder[/eluser]
in your model you didn't set your $id
Code:
function update_record($data)
    {
        $this->db->where('id', $id); //you didn't declare this $id
        $this->db->update('data', $data);
    }
should be
Code:
function update_record($data,$id)
    {
        $this->db->where('id', $id); //you didn't declare this $id
        $this->db->update('data', $data);
    }

or

function update_record($data)
    {
        $this->db->where('id', 1); //this will update your table data with id =1
        $this->db->update('data', $data);
    }

and of course you have to change your controller also
should be like this: $this->site_model->update_record($data, $id);


Messages In This Thread
Update function does not work - Beginner problem - by El Forum - 04-27-2011, 03:36 PM
Update function does not work - Beginner problem - by El Forum - 04-27-2011, 05:57 PM
Update function does not work - Beginner problem - by El Forum - 04-27-2011, 06:19 PM
Update function does not work - Beginner problem - by El Forum - 04-27-2011, 08:39 PM
Update function does not work - Beginner problem - by El Forum - 04-27-2011, 11:33 PM
Update function does not work - Beginner problem - by El Forum - 04-28-2011, 07:08 AM
Update function does not work - Beginner problem - by El Forum - 04-28-2011, 01:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB