mysql error
#1

Alright, so this is my OnPlayerDisconnect.

Код:
public OnPlayerDisconnect(playerid, reason)
{
	new query[128], aName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, aName, sizeof(aName));
	mysql_format(mysql, query, sizeof(query), "UPDATE `accounts` SET (`AdminLevel`, `Age`, `Gender`, `Skin`) VALUES ('%i', '%i', '%i', '%i') WHERE `Username` = '%s'", pInfo[playerid][AdminLevel], pInfo[playerid][Age], pInfo[playerid][Gender], pInfo[playerid][Skin], aName);
	mysql_tquery(mysql, query);
	return 1;
}
This is what my mysql_log tells me.
Код:
[23:49:22] [DEBUG] mysql_format - connection: 1, len: 128, format: "UPDATE `accounts` SET (`AdminLevel`, `Age`, `Gender`, `Skin`) VALUES ('%i', '%i', '%i', '%i') WHERE `Username` = '%s'"
[23:49:22] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `accounts` SET (`AdminLevel`, `Age`, `Gender`, `Skin`) VA", callback: "(null)", format: "(null)"
[23:49:22] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[23:49:22] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(`AdminLevel`, `Age`, `Gender`, `Skin`) VALUES ('0', '16', '1', '60') WHERE `Use' at line 1
[23:49:22] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError
What did I do wrong?
Reply
#2

%d not %i
Reply
#3

Quote:
Originally Posted by Scrillex
Посмотреть сообщение
%d not %i
That didn't fix it.

Код:
[00:01:20] [DEBUG] mysql_format - connection: 1, len: 128, format: "UPDATE `accounts` SET (`AdminLevel`, `Age`, `Gender`, `Skin`) VALUES ('%d', '%d', '%d', '%d') WHERE `Username` = '%s'"
[00:01:20] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `accounts` SET (`AdminLevel`, `Age`, `Gender`, `Skin`) VA", callback: "(null)", format: "(null)"
[00:01:20] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[00:01:20] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(`AdminLevel`, `Age`, `Gender`, `Skin`) VALUES ('0', '16', '1', '60') WHERE `Use' at line 1
[00:01:20] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError
Reply
#4

http://dev.mysql.com/doc/refman/5.5/en/update.html
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
And what exactly did I do wrong?
Reply
#6

by the way:

that:

PHP код:
UPDATE `accountsSET (`AdminLevel`, `Age`, `Gender`, `Skin`) VALUES ('%i''%i''%i''%i'WHERE `Username` = '%s' 
have 126 characters.

assume the maximum of characters in names is 24 (MAX_PLAYER_NAME), you exceeds the new query [128];
Reply
#7

Quote:
Originally Posted by _Zume
Посмотреть сообщение
by the way:

that:

PHP код:
UPDATE `accountsSET (`AdminLevel`, `Age`, `Gender`, `Skin`) VALUES ('%i''%i''%i''%i'WHERE `Username` = '%s' 
have 126 characters.

assume the maximum of characters in names is 24 (MAX_PLAYER_NAME), you exceeds the new query [128];
Ow yea, thanks.
But it still doesn't fix the error
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)