I tried changing the result of a MySQL query to an integer with intval(), but I got an error saying it could not be changed to an int. Why I want to do this is to obtain the value of one of the fields in the database, minus one from it, and update the field with the new value. How would you do this with PHP?
I tried changing the result of a MySQL query to an integer with intval()
Share
You don’t need to do it in PHP. Subtract one in the
UPDATEquery itself.Don’t forget a
WHEREclause if this is only supposed to update specific rows.