Loading bans
#1

Okay so i am trying to load bans with the correct id. Now i have this code and theres 1 ban in the mysql database. The id of the ban is 1 and the console says Ban id 0 loaded. This is the code:
pawn Код:
forward OnBansLoad();
public OnBansLoad()
{
    new rows, fields;
    cache_get_data( rows, fields, Handle);

    if(!rows)
    {
        print("Bans table is empty, no results found.");
        return 1;
    }
    new i = 0, id;
    while(rows > i)
    {
        id = cache_get_row_int(i, 0);
        BanVariable[id] = true;// You had only this, no loading any other

        printf("Ban %d Loaded", id);
        i++;
    }
    return 1;
}
How come it doesnt say Ban 1 loaded. because thats the id of the ban.
Reply
#2

Are you sure you are loading a '1' from your resultline? Try printing your row to the console when loading it and see what comes back. Maybe your query is faulty, causing an error, thus causing you to load '0' from your cache.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)