Welcome Guest, Not a member yet? Register   Sign In
How to minus number in DB
#2

(01-08-2017, 05:11 AM)falcon812311 Wrote:
PHP Code:
  function minus_set($id)
  {
    $this->db->trans_start();
    $this->db->set('total_set''total_set - 1');
    $this->db->set('price''price - 300.00');
    $this->db->where('user_id'$user_id);
    $this->db->update('users_detail'$data);
    $this->db->trans_complete();

    if ($this->db->trans_status() === TRUE)
    {
      return true;
    }
    else
    {
      return false;
    }
  
This is my model. I want subtract the total set and price. But, its not working.. how to fix it?
thanks
PHP Code:
    $this->db->set('total_set''total_set - 1',FALSE);
    $this->db->set('price''price - 300.00',FALSE); 
https://www.codeigniter.com/user_guide/d...ilder::set
Reply


Messages In This Thread
How to minus number in DB - by falcon812311 - 01-08-2017, 05:11 AM
RE: How to minus number in DB - by Paradinight - 01-08-2017, 10:18 PM
RE: How to minus number in DB - by falcon812311 - 01-11-2017, 03:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB