I know there is a way to do this. Basically I have the variable $amount and want to take that away from the column amount in the table stock.
The problem is I normally run a select query find out the value then deduct the variable and run another update query.
What is the syntax to run a single update that will just minus the value.
All help appreciated.
It’s as simple as it seems. Parentheses are optional in this example. Be sure to use the appropriate condition in your
WHEREclause!The variable
$amountis assumed to be properly escaped already, according to the MySQL API you are using, or better yet, a parameter to a prepared example, as in PDO: