When Db classes are used in zendframework, the framework automatically adds quotation marks to SQL statements to prevent database attacks. that is to say, updatetableseta = a + 1 will not be resolved to updatetableset.
When using Db classes in zendframework, the framework automatically adds quotation marks to SQL statements to prevent database attacks, that is
Update table set a = a + 1 will not be parsed as update table set a = 'A + 1', which of course cannot be correct. the solution is as follows:
$ Oid = $ this-> getRequest ()-> getParam ('option ');
$ Vote = new Vote ();
$ Db = $ vote-> getAdapter ();
$ Set = array ('optionnum' => new Zend_Db_Expr ('optionnum + 1 '));
$ Where = $ db-> quoteInto ('oid =? ', $ Oid );
$ Affected_rows = $ vote-> update ($ set, $ where );
Zend_Db_ExprThis class removes the quotation marks for the type to be converted!