0
How to subtract a value in php mysql?
$value1 = "SELECT value FROM price WHERE id = '1' "; //example the value is 200 $value2 = 100; $subtract = $value1 - $value2; But the result is: -99 How?
1 Respuesta
+ 1
The <$value1> variable is a SQL query string, not the query result. You need to execute the SQL query string and obtain the result to achieve your actual intention.
* Please confirm this by adding `echo $value1;` before declaration of <$value2> variable. It is not a good idea to do an operation involving two different types, it will most likely give weird result.