SQL Lite ( Loading from database always returns 0 )
#1

pawn Код:
GetPlayerLevel(playerid)
{
    new Query[ 200 ],Field[ 20 ];
    format(Query, sizeof(Query), "SELECT `NAME` FROM `USERS` WHERE `NAME` = '%s'", DB_Escape(Gn(playerid)));
    printf(Query);
    new DBResult:Result = db_query(Database,Query);
    db_get_field_assoc(Result, "LEVEL", Field, 30);
    printf("%i",strval(Field));
    return strval(Field);
}
Query is correct and tested, level is at default 1, it's 1 in database too, but i don't know reason why it returns me 0 all the time. No matter which level player is.
Reply
#2

You're trying to fetch a field that you haven't specified.

PHP код:
SELECT `LEVELFROM `USERSWHERE `NAME` = '%s' 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)