13.04.2013, 21:44
I have tried to make a security key with a dialog but it has a problem setting it.
Heres the code:
And heres the errors:
Error #1064 - Error: 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 ID = 1' at line 1 | Query: UPDATE players SET SKey = '', WHERE ID = 1
it is something to do with the SKey and the input text being placed in.
Heres the code:
pawn Код:
case DIALOG_SECURITY_KEY: {
if(!response)
Kick(playerid);
if(strlen(inputtext) > MAX_PASSWORD_LENGTH || strlen(inputtext) < MIN_PASSWORD_LENGTH) {
format(szMessage, sizeof(szMessage), "SERVER: Your security key must be under %d but must be above %d characters.", MAX_PASSWORD_LENGTH, MIN_PASSWORD_LENGTH);
SendClientMessage(playerid, COLOUR_GREY, szMessage);
ShowPlayerDialog(playerid, DIALOG_SECURITY_KEY, DIALOG_STYLE_PASSWORD, "SERVER: Security Key", "Set your security key for future account issues.", "Set", "Cancel");
} else {
new szQuery[256];
format(szQuery, sizeof(szQuery), "UPDATE players SET SKey = '%s', WHERE ID = %d", strlen(inputtext), Player[playerid][pDBID]);
mysql_query(szQuery, THREAD_NO_RESULT, playerid, iConnectionHandle);
SendClientMessage(playerid, COLOUR_YELLOW, "Security key has been set, we would advise you to write this down somewhere.");
}
}
Error #1064 - Error: 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 ID = 1' at line 1 | Query: UPDATE players SET SKey = '', WHERE ID = 1
it is something to do with the SKey and the input text being placed in.