How to prevent negative number in Mysql
- by Jerry
Hello guys..
I have data which is starting from 0 in my database.
My php will add 1 or -1 to the data depending on the user's input.
My problem is that if data is 0 and a user try to subtract 1. The data become 4294967295
which is the maximum value of INT data type. Are there anyways to make the data
stays in 0 even when the user asks for -1? Thanks for the reply..
my sql command is like below
update board set score=score-1 where team='TeamA'
//this would generate 4294967295 if the score is 0.....