Little Mysql Problem :)
#1

Hello,
i have a Problem with mysql.

i want to check if the Account name already is registred in the Database.

pawn Код:
public IsAccountRegistred(sqlplayersname[])
{
    new escstr[MAX_PLAYER_NAME];
    mysql_real_escape_string(sqlplayersname, escstr);
    format(query, sizeof(query), "SELECT Name FROM Accounts WHERE Name = '%s'", escstr);
    mysql_query(query);
    mysql_store_result();
    if (/*If nickname dosent exists in the Table*/)
    {
        return 0;
    }
    else
    {
        return 1;
    }
}
i know that i could use strmatch or something like this.. but i dunno how to solve it 100%...


wich function will help me out?

Friendly Greetings:
Cookie

Edit:
i thought about this code
pawn Код:
//TOP OF GM
new currentname[MAX_PLAYERS];
//Onplayerconnect
currentname[playerid] = plname;

// onplayerconnect after nickname check
if(currentname[playerid] == None)
{
gPlayerAccountRegistred[playerid] = 0;
}
public IsAccountRegistred(sqlplayersname[])
{
    new escstr[MAX_PLAYER_NAME];
    mysql_real_escape_string(sqlplayersname, escstr);
    format(query, sizeof(query), "SELECT Name FROM Accounts WHERE Name = '%s'", escstr);
    mysql_query(query);
    mysql_store_result();
    if ( strcmp( escstr , "None" , true ) == 0 )
    {
        currentname[playerid] = None;
    }
    else
    {
        currentname[playerid] = escstr;
    }
}

would this work to 100% or is there a better way?
Reply
#2

cant someone help me?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)