Mysql error.
#1

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.
Код:
[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
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.

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;
}
Reply


Messages In This Thread
Mysql error. - by rangerxxll - 13.11.2015, 05:43
Re: Mysql error. - by iKarim - 13.11.2015, 06:16
Re: Mysql error. - by rangerxxll - 13.11.2015, 07:00
Re: Mysql error. - by Ritzy2K - 13.11.2015, 10:14

Forum Jump:


Users browsing this thread: 2 Guest(s)