mysql user row to enum
#1

Hello.

I have problem trying to save the user row from mysql to an enum. For the sake of simplicity i will only use 3 columns.

the sql structure is similar to this -> username | email | money.

My enum looks like this:
pawn Код:
enum uAccount
{
     pUsername,
     pEmail,
     pMoney
};
new PlayerData[MAX_PLAYERS][uAccount];
After clicking login on "login dialog", i have a function that checks the user in database. If ok, proceeds to the data loading.

here is the function for loading..
pawn Код:
stock UserLoggedIn(playerid)
{
     format(sqlQuery, sizeof(sqlQuery), "SELECT * FROM accounts WHERE username = '%s'", PlayerName(playerid)); // PlayerName returns the name
     mysql_query(sqlQuery);
     mysql_store_result();

     if(mysql_fetch_row(sqlQuery))
     {
          sscanf(sqlQuery, "p<|>e<s[24]s[255]i>", PlayerData[playerid]);
     }
     mysql_free_result();
    return 1;
}
For testing purposes i have print the PlayerData[playerid][pUsername] and PlayerData[playerid][pMoney] and I get Username: * and Money: 0

Any help is aprreciated.
Reply


Messages In This Thread
mysql user row to enum - by [Diablo] - 12.09.2011, 09:53
Re: mysql user row to enum - by [Diablo] - 12.09.2011, 12:05
Re: mysql user row to enum - by FireCat - 12.09.2011, 12:07
Re: mysql user row to enum - by iggy1 - 12.09.2011, 12:43
Re: mysql user row to enum - by [Diablo] - 12.09.2011, 12:49
Re: mysql user row to enum - by [Diablo] - 12.09.2011, 15:00
Re: mysql user row to enum - by MadeMan - 12.09.2011, 16:48
Re: mysql user row to enum - by [Diablo] - 12.09.2011, 17:01
Re: mysql user row to enum - by MadeMan - 12.09.2011, 17:17
Re: mysql user row to enum - by [Diablo] - 12.09.2011, 17:24

Forum Jump:


Users browsing this thread: 1 Guest(s)