Display multiline and multirow SQLQuery with show_modt
Hi comunity!
I have this Problem:
I have a SQL-DB which handles my top15-Players and I want fetch the top15-Data and display it whitch show_modt (like the statsx /top15)
Here is what I coded till now:
Code:
//Connect to the DB
SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
if(g_SqlTuple == Empty_Handle)
new Handle:Query = SQL_PrepareQuery(SqlConnection,"SELECT a.name, b.rank, c.kills, c.deaths, c.hits, c.shots, c.headshotkills, c.accuracy FROM ps_plr_ids a, ps_plr b, ps_c_plr_data c WHERE b.rank <=15 AND b.rank !=0 AND a.plrid=b.plrid AND b.plrid=c.plrid GROUP BY rank ORDER BY b.rank ASC;")
run the query
if(!SQL_Execute(Query))
{
SQL_QueryError(Query,g_Error,511)
set_fail_state(g_Error)
}
fputc(top15, '^n');
fprintf(top15,"BLAAAA")
new plnick[21]
SQL_ReadResult(Query,0,plnick,20)
new plrank = SQL_ReadResult(Query,1)
new plkills = SQL_ReadResult(Query,2)
new pldeaths = SQL_ReadResult(Query,3)
new plhits = SQL_ReadResult(Query,4)
new plshots = SQL_ReadResult(Query,5)
new plheadshots = SQL_ReadResult(Query,6)
new Float:placc
SQL_ReadResult(Query,7,placc)
new Float:pleff = (100 * float(plkills) / (float(plkills) + float(pldeaths)))
%.2f",plrank, plnick, pldeaths, plhits, plshots, plheadshots, pleff, placc)
|