Loop with SQLite
#1

Hello

I tried to do the following but it didn't work

pawn Код:
command(gangs, playerid, params[])
{
    new tGid[5], tGname[100], tGOwner[25], Query[200], string[1000], DBResult:Result;
    format(Query, sizeof(Query), "SELECT * FROM `GANGS` DESC limit 10");
    Result = db_query(Database, Query);
    for (new i; i < db_num_rows(Result); i++)
    {
        db_get_field(Result, 0, tGname, sizeof(tGname));
        db_get_field(Result, 1, tGid, 5);
        db_get_field(Result, 2, tGOwner, sizeof(tGOwner));
       
    //  db_get_field_assoc(Result, "NAME", tGname, sizeof(tGname));
    //  db_get_field_assoc(Result, "OWNER", tGOwner, sizeof(tGOwner));
    //  db_get_field_assoc(Result, "ID", tGid, 5);
        format(string, sizeof(string), "ID: %d      Name: %s      Owner: %s\r\n", strval(tGid), tGname, tGOwner);
        ShowPlayerDialog(playerid, DIALOG_GANG_INFO, DIALOG_STYLE_LIST, "Gang War", string, "Info", "Cancel");
        db_next_row(Result);
       
    }
    if(db_num_rows(Result) == 0) return ShowPlayerDialog(playerid, DIALOG_GANG_INFO, DIALOG_STYLE_LIST, "Gang War", "No gangs", "Info", "Cancel");
    return 1;
}
The commented part didn't work either. How to make it so it will list all gangs made?
Reply


Messages In This Thread
Loop with SQLite - by Cowboy - 20.10.2011, 10:01
Re: Loop with SQLite - by =WoR=Varth - 20.10.2011, 10:11
Re: Loop with SQLite - by Cowboy - 20.10.2011, 10:20
Re: Loop with SQLite - by =WoR=Varth - 20.10.2011, 10:32
Re: Loop with SQLite - by Cowboy - 20.10.2011, 10:34

Forum Jump:


Users browsing this thread: 2 Guest(s)