我有一个项目表,它包含两个字段:PLEVEL1和PRINTOU 3。现在,我想UPDATE函数百分比参数,并且用PRINTOUT 3更新PLEVEL1,如下所示:
public function updatePrice($brandid, $itemgroup, $percentage){
$update=DB::table('sd_salesitems')->where('BRAND_ID', $brandid)
->where('SL_GROUP', $itemgroup)
->update(array('PLEVEL1' => 'PRINTOUT3'+'PRINTOUT3'*$percentage/100)); }
问题出在哪?
you can use this :
DB::table('sd_salesitems')
->update([
"bumped_last" => DB::raw("`PRINTOUT3 `+`PRINTOUT3`*".($percentage/100))
]);