Skip to content
This repository has been archived by the owner on Mar 20, 2019. It is now read-only.

Latest commit

 

History

History
42 lines (31 loc) · 678 Bytes

updatedecrease.md

File metadata and controls

42 lines (31 loc) · 678 Bytes

更新字段递减.updateDecrease

函数原型

更新成功后,返回影响行数,没有修改记录返回 0,updateDecrease 实际上调用的是 update 方法。

public function updateIncrease($strColumn, $intStep = 1, $arrBind = [], $bFlag = false);

用法如下

# UPDATE `test` SET `test`.`num` = `test`.`num`-3 WHERE `test`.`id` = 503 
/*
Array
(
)
*/
Db::table('test')->

where('id', 503)->

updateDecrease('num', 3);

支持表达式

# UPDATE `test` SET `test`.`num` = `test`.`num`-3 WHERE `test`.`id` = ?
/*
Array
(
    [0] => 503
)
*/
Db::table('test')->

where('id', '[?]')->

updateDecrease('num', 3, [503]);