Defense
Defense

Reputation: 259

Zend Framework: Update query

That is my update function:

$id = 5; $points = 100;

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

But, when I call this function an occurs error:

**SQLSTATE[HY093]: Invalid parameter number: no parameters were bound

Upvotes: 0

Views: 569

Answers (1)

akond
akond

Reputation: 16035

It should have been

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

Upvotes: 4

Related Questions