Welcome Guest, Not a member yet? Register   Sign In
How to use Model
#5

[eluser]Michael Wales[/eluser]
You may also be having an issue with using $this in your update_entry() method. I do believe the $this object includes a lot more than you are expecting (such as the parent controller's name). You end up passing column names to the database that don't exist.

Change your code to:

Code:
function insert_entry()
    {
        $insert->title = $_POST['title'];
        $insert->content = $_POST['content'];
        $insert->date = time();

        $this->db->insert('entries',$insert);
    }

    function update_entry()
    {
        $update->title = $_POST['title'];
        $update->content = $_POST['content'];
        $update->date = time();

        $this->db->update('entries',$update,array('id',$_POST['id']));
    }


Messages In This Thread
How to use Model - by El Forum - 10-16-2007, 02:17 AM
How to use Model - by El Forum - 10-16-2007, 02:34 AM
How to use Model - by El Forum - 10-16-2007, 06:01 AM
How to use Model - by El Forum - 10-16-2007, 07:12 AM
How to use Model - by El Forum - 10-16-2007, 09:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB