[MSQL]Need help a bit.. with explaining how to do it right...
#4

as bible already said use %e to escapename here example

pawn Code:
stock LoginPlayer(playerid)
{
    new Query[200], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    mysql_format(MySQLConnection,Query, sizeof(Query), "SELECT * FROM `players` WHERE `Name` = '%e'", name);// in mysqlconnection put yours one
    mysql_tquery(MySQLConnection, Query, "OnPlayerLogin","d",playerid);
}

public OnPlayerLogin(playerid)
{  
    new Query[200], name[24], rows, fields;
    GetPlayerName(playerid, name , sizeof(name));
    cache_get_data(rows,fields,mysqlConnectin);
    if(rows) //If the user is found
    {
        gPlayerAccount[playerid] = 1;
    }
    else
    {
        gPlayerAccount[playerid] = 0;
    }
    return 1;
}
Reply


Messages In This Thread
[MSQL]Need help a bit.. with explaining how to do it right... - by Scrillex - 28.03.2015, 06:14
Re: [MSQL]Need help a bit.. with explaining how to do it right... - by DeitY - 28.03.2015, 07:00
Re: [MSQL]Need help a bit.. with explaining how to do it right... - by AndySedeyn - 28.03.2015, 07:36
Re: [MSQL]Need help a bit.. with explaining how to do it right... - by JeaSon - 28.03.2015, 07:46

Forum Jump:


Users browsing this thread: 1 Guest(s)