SQLite help
#1

pawn Код:
function LoginPlayer(playerid)
{
    new DBResult: Result;
    format(Query, sizeof(Query),"SELECT * FROM `Users` WHERE `Username` = '%s'", GetPName(playerid));
    Result = db_query(Users,Query);
    new Field[30];

    db_get_field_assoc(Result, "Money", Field, 30);
    PInfo[playerid][Money] = strval(Field);

    db_get_field_assoc(Result, "Jailed", Field, 30);
    PInfo[playerid][Jailed] = strval(Field);

    db_get_field_assoc(Result, "Jailtime", Field, 30);
    PInfo[playerid][Jailtime] = strval(Field);
   
    GivePlayerMoney(playerid,PInfo[playerid][Money]);
    PInfo[playerid][Logged] = 1;
   
    db_free_result(Result);
    return 1;
}
When the player disconnects from the server, it saves the stats. (I printed it)
But when he logs in, and I print the previous vars, it prints (null).
Whats wrong?
Reply
#2

Im not sure how much MySql and sqlite are similar but in mysql you need to store result so i guess in sqllite you need to....
Reply
#3

yes DRIFT _HUNTER right
Reply
#4

Quote:
Originally Posted by ahbir_jhon
Посмотреть сообщение
yes DRIFT _HUNTER right
No shit Sherlock.

He solved the problem. He forgot to add the Robbed and HasRobbed columns.
And he was actually trying to store values to those 2 columns, and since those don't exist the whole query stops.
Reply
#5

Quote:
Originally Posted by Zh3r0
Посмотреть сообщение
No shit Sherlock.

He solved the problem. He forgot to add the Robbed and HasRobbed columns.
And he was actually trying to store values to those 2 columns, and since those don't exist the whole query stops.
Thanks! (:
Rep :b
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)