Display results from DB into a dialog
#6

What are your tables?

I don't really know how you want it so heres a start

pawn Код:
CMD:reports(playerid, params[])
{
    if(pStats[playerid][pAdmin] < 1)
        return 1;

    new szQuery[96], iStart = 0, iEnd = 15;
    format(szQuery, sizeof(szQuery), "SELECT * FROM `reportsLog` LIMIT %d, %d", iStart, iEnd);
    mysql_function_query(1, szQuery, true, "thread_LoadReports", "d", playerid);
    return 1;
}

forward thread_LoadReports(playerid);
public thread_LoadReports(playerid)
{//place your ConnectionHandle var
    new row, rows, fields, dest[144], BigVar[1024]; // is 144 the max report length? it's a dialog right? so you might need a large string length
    cache_get_data(rows, fields);
    if(rows > 0)
    {
        while(row < rows)
        {
            cache_get_row(row, 0, dest, ConnectionHandle);
            format(BigVar, sizeof(BigVar), "Report ID [%d]: %s", row, dest);
            ++row;
        }
        ShowPlayerDialog(playerid, dialogid, MSGORLIST?, "Report Log", BigVar, "Select", "Close");
    }
    else
    {
        ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, "Report Log", "There are no reports in this criteria", "Close", "");
    }
    return 1;
}
Reply


Messages In This Thread
Display results from DB into a dialog - by Scenario - 27.11.2012, 00:04
Re: Display results from DB into a dialog - by mastermax7777 - 27.11.2012, 00:08
Re: Display results from DB into a dialog - by Scenario - 27.11.2012, 00:10
Re: Display results from DB into a dialog - by Kar - 27.11.2012, 00:12
Re: Display results from DB into a dialog - by Scenario - 27.11.2012, 00:20
Re: Display results from DB into a dialog - by Kar - 27.11.2012, 00:25
Re: Display results from DB into a dialog - by Scenario - 27.11.2012, 00:32
Re: Display results from DB into a dialog - by Kar - 27.11.2012, 00:44
Re: Display results from DB into a dialog - by Scenario - 27.11.2012, 00:47

Forum Jump:


Users browsing this thread: 1 Guest(s)