MySQL issues.
#2

Quote:
Originally Posted by yanir3
Посмотреть сообщение
Hey, I recently started working with mySQL, I have a problem with my login system.
It's just not loading the stats.

pawn Код:
forward LoadUser(playerid);
public LoadUser(playerid)
{
new query[256];
format(query, sizeof(query),"SELECT * FROM playerinfo WHERE Name=%s",pName(playerid));
mysql_query(query);
mysql_store_result();
if(mysql_num_rows())
if(mysql_fetch_row_format(query,"|"))
{
        new field[13][MAX_PLAYER_NAME];
        explode(query, field, "|");
        mysql_free_result(); // This line must be under all other things you want to set
        PlayerInfo[playerid][Money] = strval(field[3]);
        PlayerInfo[playerid][Admin] = strval(field[4]);
        PlayerInfo[playerid][Level] = strval(field[5]);
        PlayerInfo[playerid][Bank] = strval(field[6]);
        PlayerInfo[playerid][Kills] = strval(field[7]);
        PlayerInfo[playerid][Deaths] = strval(field[8]);
        PlayerInfo[playerid][Skin] = strval(field[9]);
        PlayerInfo[playerid][Job] = strval(field[10]);
        PlayerInfo[playerid][Watch] = strval(field[11]);
        PlayerInfo[playerid][Notepad] = strval(field[12]);
}
}
I can't find the problem.. can someone help me please?
As you see above in the comment you free the result before you set anything put it under your last thing you want to get
Reply


Messages In This Thread
MySQL issues. - by yanir3 - 16.06.2011, 17:27
AW: MySQL issues. - by xerox8521 - 16.06.2011, 18:16
Re: MySQL issues. - by yanir3 - 16.06.2011, 18:29
AW: Re: MySQL issues. - by xerox8521 - 16.06.2011, 18:33
Re: MySQL issues. - by yanir3 - 16.06.2011, 18:50
AW: MySQL issues. - by xerox8521 - 16.06.2011, 18:58
Re: MySQL issues. - by yanir3 - 17.06.2011, 11:07
Re: MySQL issues. - by yanir3 - 19.06.2011, 04:46
Re: MySQL issues. - by Calgon - 19.06.2011, 04:49

Forum Jump:


Users browsing this thread: 2 Guest(s)