ON DUPLICATE KEY UPDATE Problems [mySQL]
#1

How do you work "ON DUPLICATE KEY UPDATE" Properly? I think i have it right but giving errors.

Error in mysql_debug..
Код:
(Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET `pies` = 1 WHERE Username = '[BOT]Jenkins'' at line 1)
And the code causing the error.

pawn Код:
format(Queryy, sizeof(Queryy), "INSERT INTO `piecount` (Username,`%s`) VALUES ('%s',1) ON DUPLICATE KEY UPDATE piecount SET `%s` = 1 WHERE Username = '%s'",name,Pname,name,Pname);
Any idea on causing this?
Reply
#2

Probably also with the VALUES identifier.

Код:
ON DUPLICATE KEY UPDATE `piecount` SET (`%s`) VALUES ('1') WHERE Username = '%s';
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Probably also with the VALUES identifier.

Код:
ON DUPLICATE KEY UPDATE `piecount` SET (`%s`) VALUES ('1') WHERE Username = '%s';
didnt fix it, IDK wtf is causing teh error, but i just made a function to check if it exists > Update, else, insert.

Thanks anyways
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)