I was able to successfully create the following php mathematical equation using a value derived earlier in a MYSQL query. This works great except for when the value for $sum_total is below 200, in that case I need to show $sum_total as 0 instead of the value under 200 after subtraction. What is the best way to handle this?
$first_number = $row['PriceAverage'];
$second_number = 200;
$sum_total = $first_number - $second_number;
add after the last line:
if ($sum_total < 200) $sum_total = 0;
A simple if
statement will do the job:
if ($sum_total < 0) $sum_total = 0;