MySQL return variable
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Remove the forward part of it.

pawn Код:
stock GetPlayersRealId(playerid)
{
    new query[71], usersname[MAX_PLAYER_NAME], id;
    GetPlayerName(playerid, usersname, sizeof(usersname));
    format(query, sizeof(query), "SELECT id FROM playerdata WHERE user = '%s' LIMIT 1", usersname);
    mysql_query(query);
    mysql_store_result();
    if(mysql_num_rows())
    {
        id = mysql_fetch_int();
        mysql_free_result();
    }
    return id;
}
You had wrong in the syntax: '$s' instead of '%s'. The order by is not useful for that case. First store and then check the rows.
I will edit the post when I tried.

EDIT: It works, I will give u rep .
Reply


Messages In This Thread
MySQL return variable - by trukker1998 - 19.02.2014, 09:01
Re: MySQL return variable - by Misiur - 19.02.2014, 10:19
Re: MySQL return variable - by Konstantinos - 19.02.2014, 10:33
Re: MySQL return variable - by trukker1998 - 19.02.2014, 11:14

Forum Jump:


Users browsing this thread: 3 Guest(s)