【发布时间】:2015-02-25 01:00:51
【问题描述】:
我正在尝试使用 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
【问题讨论】:
标签: php method-chaining phpactiverecord codeigniter-3