Incrementing Cakephp database field by a value

后端 未结 4 778
挽巷
挽巷 2020-12-06 06:04

I have this field whose value i have to increment the field value by a specific value. I am using this

$data[\'quantity\']     = \'Order.quantity+1\';
         


        
4条回答
  •  醉话见心
    2020-12-06 06:50

    Using saveField:

    Article->id = $id;
    $this->Article->saveField('viewed', (int)$this->Article->field('viewed') + 1);
    
    ?>
    

提交回复
热议问题