MySQL error
#1

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?
Reply
#2

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

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);
Reply
#4

Damn totaly forgot dat keyword. Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)