Cannot update specific existing column with value

127 views Asked by At

I would like to increment an existing column in my usertable with a dynamic atttribute (karma points)

function updateUserKarmaPoints($karmapoints,$userid){
    $userkarmaptsarr = array('karmapoints' => new Zend_Db_Expr('karmapoints')+$karmapoints);
    $this->dbo->update('users', $userkarmaptsarr, $this->dbo->quoteInto('id = ?', $userid));
}

The above update statement does not work and it gives me this error message.

( ! ) Notice: Object of class Zend_Db_Expr could not be converted to int in C:\wamp\models\KarmaModel.php on line 13

May i know where did i go wrong.

Cheers

1

There are 1 answers

0
Slay On

resolved it. For future references.

function updateUserKarmaPoints($karmapoints,$userid){
    $userkarmaptsarr = array('karmapoints' => new Zend_Db_Expr('karmapoints + '.$karmapoints));
    $this->dbo->update('users', $userkarmaptsarr, $this->dbo->quoteInto('id = ?', $userid));
}