AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Whats wrong with this SQL syntax? (https://forums.alliedmods.net/showthread.php?t=309205)

jonatat 07-17-2018 11:20

Whats wrong with this SQL syntax?
 
PHP Code:

formatexszQuery2999"INSERT INTO `match_players` (`steam_id`, `username`, `kills`, `deaths`, `team`, `match_id`) VALUES ('%s', '%s', '%d', '%d', '%d', '%s') ON DUPLICATE KEY UPDATE `steam_id` = '%s', `username` = '%s', `kills` = '%d', `deaths` = '%d' WHERE `steam_id` = '%s'"authname[id], pTempKills[id], pTempDeaths[id], Team[id], szLineauthname[id], pTempKills[id], pTempDeaths[id], auth

Getting error:


PHP Code:

You have an error in your SQL syntaxcheck the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE `steam_id` = 'STEAM_0:0:154554389'' at line 1 


jimaway 07-17-2018 17:34

Re: Whats wrong with this SQL syntax?
 
you don't have to specify what rows to update when using ON DUPLICATE KEY. just remove the WHERE `steam_id` = '%s' part


All times are GMT -4. The time now is 12:34.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.