You can do the following: we index the player column with a unique index
ALTER TABLE DonateCoins ADD UNIQUE KEY player (player);
This will not allow duplicate records to be inserted into the DonateCoins table. We insert new data with an INSERT request with ON DUPLICATE KEY UPDATE , in which we write the logic for updating the field when an insert record is detected with an already existing player.
INSERT INTO DonateCoins (`player`, `donateCoins`) VALUES ('test', '20202') ON DUPLICATE KEY UPDATE donateCoins = donateCoins + VALUES(donateCoins);
As a result, if the entry already exists, donateCoins will increase by 20202 (the column type must be numeric, not text).
show create table %tableName%resultshow create table %tableName%when you ask sql-related questions, and specify the exact name of the database in the tag. is it mssql, sql, firebird, postgres? - strangeqargo