Well this problem has been bugging me for days.
I have a mysql table with some of these fields:
money | bigint | 40 | Default: 0 | unsigned
Now the problem I am having is that my script is somehow maxing out the value in the money field with simple mysql addition and subtraction. This only happens when 2 people reference a script that updates 1 persons money.
One person goes to the bank.php and deposits say 200,000. At the same time another user goes to battle.php and attacks the first person. Because of the lag in the scripts all the sudden the first person has 1.8446744069415E+19 for there money. As you know this is exactly the maximum integer for a bigint field that is unsigned.
Now my queries looking something like this when I print it out when there executing.
Update table set money=money+$deposit where playerid=$id
Update table set money=money-$battleloss where playerid=$id
They are simple math operations like that. I tried every combination of the query I could and they all worked fine without making the value to the max. I tried money=money+-100, money=money+100, money=money--100. I tried every form that I could and none of them will work.
What would cause a mysql query to set a field value to the maximum that it could be? In only seems to happen when 2 separate queries in 2 separate queries run at the same time updating the same field.
Im really struggling on fixing this bug that generates, who knows what that number is called.
Thank you for any help you can provide.









Bookmarks