Welcome Guest, Not a member yet? Register   Sign In
Active Record method chaining - doesn't work with update?
#1

Already posted to SO, but thought I might as well try at Mecca as well.

I'm trying to use Active Record methods to update a table and flag a task as complete like this:

$this->db->update('tasks', array('status' => 'complete'))
->where('id', $task_id);

But it's giving me an error:

Call to a member function where() on a non-object

Is there something wrong here that I can't see here? or does method chaining not work with update? The docs are pretty thin on method chaining..

It does work if I break it into two lines...

$this->db->where('id', $task_id);
$this->db->update('tasks', array('status' => 'complete'));
but shouldn't method chaining work here?

PHP version: 5.5.4 CI version: 3
Reply


Messages In This Thread
Active Record method chaining - doesn't work with update? - by whiteatom - 02-25-2015, 10:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB