MySQL help
#1

hey,
I've made a register 'n' login system with a MYSQL. Now, this is my login stock:
pawn Код:
stock LoginPlayer(playerid,const password[])
{
    new string[200];
    new EscapedText[60];
    mysql_real_escape_string(password, EscapedText);
    format(string,sizeof(string),"SELECT FROM `account` WHERE `Username` = '%s' AND `Password` = '%s'",GetName(playerid),EscapedText);
    mysql_query(string);
    mysql_store_result();
    if(mysql_num_rows() != 0)
    {
        SendClientMessage(playerid,COLOR_DARKGREEN,"You have been logged in!");
        LoadStats(playerid);
    }
    else
    {
        SendClientMessage(playerid,COLOR_RED,"You've entered wrong password. Will be kicked due to security reasons.");
        Kick(playerid);
    }
    mysql_free_result();
    return 1;
}
Now, when I login, it was supposed to write something, and it didn't. I haven't even login. I can write any password and I can respawn. Otherwise, it doesn't load my stats.
How can I make an if() that will check if the password contains the data of the columm on the MYSQL?
Reply
#2

I don't get what you mean but I think you need to add a wildcard after 'SELECT' on the query ('*' - "SELECT * FROM...")
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)