mysql_tquery doesnt work
#1

mysql slowly kills me, lol


Код:
public OnPlayerConnect(playerid)
{
    TogglePlayerSpectating(playerid, true);
    new query[128], playername[MAX_PLAYER_NAME];

    GetPlayerName(playerid, playername, sizeof(playername));
    mysql_format(mysql, query, sizeof(query), "SELECT `Password`, `ID` FROM `accounts` `Name` = '%e' LIMIT 1", playername);
    mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid);
    
    return 1;
}


forward OnAccountCheck(playerid);
public OnAccountCheck(playerid)
{
print("check");
    new rows, fields;
    cache_get_data(rows, fields, mysql);

    if(rows)
    {
        cache_get_field_content(0, "Password", Player[playerid][Password], mysql, 129);
        Player[playerid][ID] = cache_get_field_content_int(0, "ID");
        ShowPlayerDialog(playerid, Log, DIALOG_STYLE_INPUT, "Login", "Welcome player!\nYour account has been found in our database. Please fill in your password:", "Login", "Quit");
	}
    else
    {
      ShowPlayerDialog(playerid, Reg, DIALOG_STYLE_INPUT, "Register", "Welcome player!\nYour account has not been registered yet. Please fill in your desired password:", "Register", "Quit");
    }
    return true;
}
when player connect I dont get print "check"
Reply
#2

In your MySQL log file you WILL find this snippet:
Код:
check the manual that corresponds to your MySQL server version for the right syntax to use near '`Name`'
Because you have forgotten to put the WHERE clause. This is why you check the logs first before asking for help elsewhere. Many problems could be solved if only one would read error messages and know where to look for them.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
In your MySQL log file you WILL find this snippet:
Код:
check the manual that corresponds to your MySQL server version for the right syntax to use near '`Name`'
Because you have forgotten to put the WHERE clause. This is why you check the logs first before asking for help elsewhere. Many problems could be solved if only one would read error messages and know where to look for them.
k thx dude
Reply
#4

Quote:
Originally Posted by Aa12
Посмотреть сообщение
mysql slowly kills me, lol
Once you have it down, it is a wonderful (and fast) tool to have that is useful for way more than just SA-MP.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)