我正在尝试使用 Active Record 方法更新表并将任务标记为完成,如下所示:
$this->db->update('tasks', array('status' => 'complete'))
->where('id', $task_id);
但这给了我一个错误:
Call to a member function where() on a non-object
这里有什么问题我在这里看不到吗?还是方法链接不适用于更新?文档在方法链接上非常薄..
如果我把它分成两行它确实有效......
$this->db->where('id', $task_id);
$this->db->update('tasks', array('status' => 'complete'));
但是方法链不应该在这里工作吗?
PHP版本:5.5.4 CI版本:3