Zend Framework:更新查询

时间:2012-09-13 02:29:51

标签: zend-framework

这是我的更新功能:

$id = 5; $points = 100;

public function update($id, $points) {
    $this->update(array('points = ?' => new Zend_DB_Expr('points + 1')), array('id = ?' => $id));
}

但是,当我调用此函数时会发生错误:

  

** SQLSTATE [HY093]:参数号无效:没有参数被绑定

1 个答案:

答案 0 :(得分:4)

应该是

$this->update (array (
    'points' => new Zend_DB_Expr ('points + 1') 
), array (
    'id = ?' => $id 
));