13.11.2015, 05:43
Hello, everyone.
I decided to learn mysql and my log is giving me an error. I'm trying to make a registration system and when a player connects - the dialog doesn't show. I read the log, and it looks like a string issue with my username, but I'm not entirely sure.
Here's the log.
And this is relevant code. I decided to follow a tutorial (I wrote all the code by hand for hands-on practice.) If you need anymore code, please let me know. Thank you.
I decided to learn mysql and my log is giving me an error. I'm trying to make a registration system and when a player connects - the dialog doesn't show. I read the log, and it looks like a string issue with my username, but I'm not entirely sure.
Here's the log.
Код:
[22:38:09] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:38:35] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT `pPass`, `pID` FROM `players` WHERE `Username` = `%e` LIMIT 1" [22:38:35] [DEBUG] mysql_tquery - connection: 1, query: "SELECT `pPass`, `pID` FROM `players` WHERE `Username` = `Rangerx", callback: "OnAccountCheck", format: "i" [22:38:35] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - starting query execution [22:38:35] [ERROR] CMySQLQuery::Execute[OnAccountCheck] - (error #1054) Unknown column 'Rangerxxll' in 'where clause' [22:38:35] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - error will be triggered in OnQueryError
pawn Код:
public OnPlayerConnect(playerid)
{
new query[128], ip[16];
GetPlayerName(playerid, Name[playerid],24);
GetPlayerIp(playerid, ip, sizeof(ip));
mysql_format(mysql, query, sizeof(query), "SELECT `pPass`, `pID` FROM `players` WHERE `Username` = `%e` LIMIT 1", Name[playerid]);
mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid);
return 1;
}
forward OnAccountCheck(playerid);
public OnAccountCheck(playerid)
{
new rows, fields;
cache_get_data(rows, fields, mysql);
if(rows)
{
cache_get_field_content(0, "pPass", pInfo[playerid][pPass], mysql, 129);
pInfo[playerid][pID] = cache_get_field_content_int(0, "pID");
printf("%s", pInfo[playerid][pPass]);
ShowPlayerDialog(playerid, REGISTER_LOGIN, DIALOG_STYLE_INPUT, "Login", "In order to play, you need to login", "Login", "Quit");
}
else
{
ShowPlayerDialog(playerid, REGISTER_REGISTER, DIALOG_STYLE_INPUT, "Register", "In order to play, you need to register.", "Register", "Quit");
}
return 1;
}