Quote:
Originally Posted by Bugsy
You can also use REPLACE INTO if your table is created properly.
Code:
REPLACE works exactly like INSERT , except that if an old row in the table has
the same value as a new row for a PRIMARY KEY or a UNIQUE index, the old row is
deleted before the new row is inserted. See Section 12.2.5, “ INSERT Syntax”.
REPLACE is a MySQL extension to the SQL standard.
You can make the steam ID your primary key since this value is static.
Code:
CREATE TABLE IF NOT EXISTS tblPlayerData (SteamID VARCHAR(34) PRIMARY KEY , PlayerName VARCHAR(32), PlayTime INTEGER);
REPLACE INTO tblPlayerData (SteamID, PlayerName, PlayTime) VALUES ('STEAM123','bugsy',1);
|
You really helped me with PRIMARY_KEY!
Does it okay?
Code:
formatex( szQuery, 3799, "UPDATE `users` SET `steam_id` = '%s', `player_name` = '%s', `kills` = '%d', `deaths` = '%d', `headshots` = '%d', `aces` = '%d', `m_aces` = '%d', `mix_played` = '%d', `mix_lost` = '%d', `mix_won` = '%d', `mix_draw` = '%d', `points` = '%d' WHERE `steam_id` = '%s';", steam, GetSecureName(Name), pKills[id], pDeaths[id], pHeadshots[id], pAces[id], pMiniAces[id], pMixPlayed[id], pMixLost[id], pMixWon[id], pMixDraw[id], pPoints[id], steam);