【问题标题】:Yii. Use updateAll without exact setting value of parameter易。在没有准确设置参数值的情况下使用 updateAll
【发布时间】:2014-08-09 09:29:10
【问题描述】:

如何在没有准确设置参数值的情况下使用 updateAllupdateCounters 更新行?

我有什么:

Ratings::model()->updateAll(
            array( 'o' => $howAdd, 'last' => $ins),
            "AND type = {$type} AND num = {$num}");

我需要什么: 将 'o' 的值设置为 'o' = 'o' + $howAdd

【问题讨论】:

    标签: php activerecord yii


    【解决方案1】:

    不太确定是否可以通过 updateAll 实现这一目标

    但是,如果您的值 $howadd 是整数 您可以尝试查看 updateCounters。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-03-20
      • 2012-05-03
      • 2014-01-07
      • 1970-01-01
      • 1970-01-01
      • 2021-10-27
      • 2017-04-15
      相关资源
      最近更新 更多