title: Execute OPERATION (plus, minus, multiply, divide) in Update SQL
body: <p>How to execute plus, minus, multiply or divide operation in SQL to the selected table and row?</p>
  
  <p>Below is example code where I manually minus original quantity to create a new quantity and update into the selected row:</p>
  
  <pre>
  $idArr = $_POST['checkboxId'];
  
  foreach($idArr as $index=>$value)
  {
      $id = mysql_real_escape_string($value);
  
      // Get Quantity from this item id
      $sql = "SELECT quantity FROM items WHERE item_id = '$id'";
      $result = mysql_query($sql);
      $quantity = $row['quantity'];
  
      // New quantity after minus by 1
      $new_quantity = $row['quantity'] - 1;
  
      // Update new quantity to this item
      $sql = "UPDATE items SET quantity = '$new_quantity' WHERE item_id = '$id'";
      $result = mysql_query($sql);
  }
  </pre>
  
  <p>Is it a practical way to update changes of quantity(integer) in preferred rows?
  Can I do that with a single update query?</p>