Raised This Month: $32 Target: $400
 8% 

Whats wrong with this SQL syntax?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jonatat
Senior Member
Join Date: Dec 2017
Old 07-17-2018 , 11:20   Whats wrong with this SQL syntax?
Reply With Quote #1

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 
jonatat is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 07-17-2018 , 17:34   Re: Whats wrong with this SQL syntax?
Reply With Quote #2

you don't have to specify what rows to update when using ON DUPLICATE KEY. just remove the WHERE `steam_id` = '%s' part
jimaway is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:11.


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