Top queries (SQL)
#3

That should work:
pawn Code:
COMMAND:top( playerid, params[ ] )
{
    new
        string[ 44 ],
        info[ 2 ][ MAX_PLAYER_NAME ],
        DBResult: result
    ;

    result = db_query( Database, "SELECT Name, KILLS FROM USERS ORDER BY KILLS DESC LIMIT 3" );

    for( new a; a != db_num_rows( result ); a++ )
    {
        db_get_field( result, 0, info[ 0 ], MAX_PLAYER_NAME );
        db_get_field( result, 1, info[ 1 ], 7 );

        format( string, sizeof( string ), "%d. %s Amount (%d)", a + 1, info[ 0 ], strval( info[ 1 ] ) );
        SendClientMessage( playerid, -1, string );

        db_next_row( result );
    }
    db_free_result( result );
    return 1;
}
Reply


Messages In This Thread
Top queries (SQL) - by [SF]OutLawZ - 22.11.2013, 13:17
Re: Top queries (SQL) - by Jefff - 22.11.2013, 13:37
Re: Top queries (SQL) - by Konstantinos - 22.11.2013, 13:37
Re: Top queries (SQL) - by [SF]OutLawZ - 22.11.2013, 13:54

Forum Jump:


Users browsing this thread: 1 Guest(s)