there is a function used to decrease the number of sellers of a book in our project it is that function
class listab_Model_Books extends listab_Model_BaseBooks
{
public function decreaseSeller($code)
{
$row = Doctrine_Query::create()
->from('listab_Model_Books b')
->where('b.code = ?',$code)
->fetchOne();
// var_dump($row['seller']);
$q = Doctrine_Query::create()
->from('listab_Model_Books b')
->set('b.seller = ?',$row['seller']-1)
->where('b.code = ?',$code)
->execute();
}
}
when i try to use this function it gives me this error
SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens dotrine
what am i doing wrong 🙁
Edited for correctness.
I believe “set” should be used only with update, like this:
If what you are trying is to do an update you should use the “update” clause. Otherwise it’ll be taken as a select.