SA-MP Forums Archive
MySQL error - 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)
+--- Thread: MySQL error (/showthread.php?tid=563836)



MySQL error - kamiliuxliuxliux - 17.02.2015

Hi,
I haven't scripted for awhile, so I forgot many things... Here are lines, which cannot be executed:
pawn Код:
new query[200];
        mysql_format(sql,query,200,"INSERT INTO `accounts` (`Skin`) VALUES ('%i') WHERE `Nickname` = '%e'",id,Name(playerid));
        mysql_query(sql,query);
Looks like I'm doing everything OK, but mysql_log gives me this:
pawn Код:
[19:08:14] [ERROR] CMySQLQuery::Execute[()] - (error #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 'WHERE `Nickname` = 'My_Dog'' at line 1
What is wrong?



Re: MySQL error - HazardouS - 17.02.2015

INSERT INTO doesn't support "WHERE". Use UPDATE `accounts` SET `Skin` = `%i` WHERE `Nickname` = '%e'.


Re: MySQL error - JeaSon - 17.02.2015

i think in insert you dont need WHERE Nickname correct me if im wrong
pawn Код:
new query[200];
        mysql_format(sql,query,200,"INSERT INTO `accounts` (`Skin`) VALUES ('%i'),id);
        mysql_query(sql,query);



Re: MySQL error - kamiliuxliuxliux - 17.02.2015

Damn totaly forgot dat keyword. Thank you!