ON DUPLICATE KEY UPDATE Problems [mySQL] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: ON DUPLICATE KEY UPDATE Problems [mySQL] (
/showthread.php?tid=173506)
ON DUPLICATE KEY UPDATE Problems [mySQL] -
DiddyBop - 02.09.2010
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?
Re: ON DUPLICATE KEY UPDATE Problems [mySQL] -
Vince - 02.09.2010
Probably also with the VALUES identifier.
Код:
ON DUPLICATE KEY UPDATE `piecount` SET (`%s`) VALUES ('1') WHERE Username = '%s';
Re: ON DUPLICATE KEY UPDATE Problems [mySQL] -
DiddyBop - 02.09.2010
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