I want to decrement a value when user delete it in php and mysql. I want to check not to go below than 0. If value is 0 then do not decrement.
mysql_query("UPDATE table SET field = field - 1 WHERE id = $number");
If field is 0 then do not do anything
Add another condition to update only if the field
is greater 0
UPDATE table
SET field = field - 1
WHERE id = $number
and field > 0