16.08.2012, 22:43
i made this to store retrieved data from the database but it always gets me null
the definitions
The function to retrieve data from the database then saves it into the variables
Then when i do this
it tells me in the console that the value is null, although it is 5000
Please i need an immediate help and thanks
the definitions
pawn Код:
enum pIN
{
SCORE,
MONEY,
KILLS,
DEATHS
};
new pInfo[MAX_PLAYERS][pIN];
The function to retrieve data from the database then saves it into the variables
pawn Код:
stock ret_cDATA(playerid)
{
new
Query[ 256 ],
Messages[ 256 ],
DBResult: Result,
pName[ MAX_PLAYER_NAME ],
Field[ 50 ]
;
format(Query, sizeof(Query), "SELECT * FROM `Accounts` WHERE `NAME` = '%s' COLLATE NOCASE", DB_Escape(pName));
Result = db_query(DATABASE, Query);
pInfo[playerid][SCORE] = db_get_field_assoc(Result, "SCORE", Field, 30);
pInfo[playerid][MONEY] = db_get_field_assoc(Result, "CASH", Field, 30);
pInfo[playerid][KILLS] = db_get_field_assoc(Result, "KILLS", Field, 30);
pInfo[playerid][DEATHS] = db_get_field_assoc(Result, "DEATHS", Field, 30);
print(pInfo[playerid][MONEY]);
}
pawn Код:
ret_cDATA(playerid);//onplayerconnect
Please i need an immediate help and thanks