`
fxyc
  • 浏览: 122118 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Zend Framework关于Update语句写法

    博客分类:
  • PHP
阅读更多
对于update table1 set c1 = c1 +1 where。。。
语句在zend中如果用常规的方式会被解析为:update table1 set c1 = ‘c1 +1’ where。。。

可以通过以下方式来处理

public function updateworkpageReplySum( $id =0){
        $db = $this->getAdapter();
        $set = array('replysum'=>new Zend_Db_Expr('replysum+1'),'updatetime'=>new Zend_Db_Expr('NOW()'));
        $where = $db->quoteInto('uuid = ?', $id);
        $rows_affected = $db->update( $this->_name, $set, $where );
        return $rows_affected ;
    }
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics