-1

I have some game servers that I run, and as my players play, they collect in game money for time played and PVP players killed, and use it to purchase gear in game. I recently had some downtime and want to give all my players a bonus of 1000 in game money to compensate, but my MySQL knowledge is limited.

All of the money data is stored in a simple database table, there are 3 field; Steam 64|Balance|LastUpdated

Here is the structure:

**Field     |Type         |Collation       |Attributes                  |Null   |Default**
steamId     |varchar(32)  |utf8_general_ci |                            |No     |None   
balance     |decimal(15,2)|                |                            |No     |25.00
lastUpdated |timestamp    |                |on update CURRENT_TIMESTAMP |No     |0000-00-00 00:00:00    

Is there an operation that I can use to go through the entire balance table, look at the current value, and add 1000 to every players current balance?

I only have access to this database via PHPMyAdmin as it's hosted by network solutions.

Thanks

Ajster1989
  • 197
  • 1
  • 12

1 Answers1

2

Yes, yet is called update:

update balancetable
    set balance = balance + 1000;

You can also add a where clause to filter the table so only certain rows are updated.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786