【问题标题】:Zend_Db -> update() increments my values twiceZend_Db -> update() 将我的值增加两次
【发布时间】:2013-05-26 12:18:03
【问题描述】:

这是我的代码:

$update_data = array('post_browe_count'=>new Zend_Db_Expr('post_browe_count+1'));

$rowaffected = $contentmodel->update_post('posts',$update_data,$id);

我的类直接从 Zend_Db_Table_Abstract 扩展,我该如何解决它

【问题讨论】:

标签: php mysql zend-framework


【解决方案1】:

这里我给你一个使用产品和增加数量字段的例子:

$table     = 'products'; 
$data      = array('prd_qnty' => new Zend_Db_Expr('product_qnty + 1')); 
$where[] = $db->quoteInto('product_id = ?', $this->pr_id); 
$db->update($table, $data, $where);

请尝试按照上述方式进行查询。所以它肯定对你有用。

如果我能帮助你更多,请告诉我。

【讨论】:

    猜你喜欢
    • 2019-09-19
    • 2017-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-14
    • 1970-01-01
    • 2020-02-14
    • 1970-01-01
    相关资源
    最近更新 更多