Welcome Guest, Not a member yet? Register   Sign In
Active record Update issue

please i keep getting an error with my code below.
i am trying to update a table.
i believe i am doing everything ok.

please help.

$array = array('timeregistered' => $timereg, 'password' => $password);
        $this->db->set('active', 1);

[b]LINE 34[/b]    if($query->num_rows() > 0){
        return true;
        return FALSE;

Fatal error: Call to a member function num_rows() on a non-object in D:\dumps\opensource\projects\nightengale\bizlocator\system\application\models\users\usersmodel.php on line 34

Hi chinedubond, update method doesn't return query object. You can use affected_rows() method instead:
if ($this->db->affected_rows() > 0)
    return true;
    return false;

db::update() returns true/false depending on if the query succeeds or not.

Use db->affected_rows() to find how many rows that were altered.

EDIT: to slow Smile

Theme © iAndrew 2016 - Forum software by © MyBB