I am working on a card game with two medieval kingdoms are battling with different character cards. There are 30 playing spots on the board, six for each kingdom they are fighting over. Some of the cards have the ability to stack on top of each other like and advisor making a colored playing area wild and opening to any color of card being played on top of it. Some cards have the ability to 'kill' other characters and in the case of a stack of cards each card needs to be updated in the database of where it is in the stack. The 'Bard' card can charm another card and pull it over to an opponents side the kingdom. In these types of cases there are multiple updates to the database that need to occur that cannot be done in one query which have to occur before changing state and\or moving to a new routine in the program. Sometimes when these updates are done too close together, but not all of the time, I get a 'Unexpected error: mysql_deadlock_restart_transaction' and the subsequent database updates are not done. If I put a short pause inbetween the updates they still happen but the error message still pops up sometimes even though the updates have occured properly. These messages can be distressing to the user who is wondering if his game is going to error out.
How can I do multiple updates to the database with getting the 'Unexpected error: mysql_deadlock_restart_transaction' error? This happens several places in the program where I have to do this.
How can I do multiple updates to the database with getting the 'Unexpected error: mysql_deadlock_restart_transaction' error? This happens several places in the program where I have to do this.