MySQL R39 /top10
#1

How can i make /top10 system with mysql r39-3? Please help me.
Reply
#2

you can use ORDER BY statements for that purpose
Reply
#3

I know it but how can i convert this code to mysql r39 version(cache)

Код:
mysql_query("SELECT score, username FROM usertable ORDER BY score DESC LIMIT 10");
mysql_store_result();
new id;
while(mysql_retrieve_row())
{
    id ++;
    new username[24], scorevariable[5];
    mysql_fetch_field_row(username, "username");
    mysql_fetch_field_row(scorevariable, "score");
    printf("Position %d: Username - %s | Score: %d", id, username, strval(scorevariable));
}
mysql_free_result();
Reply
#4

pawn Код:
new Cache:result, rows;
result = mysql_query(connection_handle, "SELECT score, username FROM usertable ORDER BY score DESC LIMIT 10");
if((rows = cache_num_rows(result)))
{
    new id, score, username[MAX_PLAYER_NAME + 1];
    for(new i=0; i < rows; i++)
    {
        score = cache_get_row_int(i, 0);
        cache_get_row(i, 1, username);
        printf("Position %d: Username - %s | Score: %d", ++id, username, score);
    }
}
cache_delete(result);
you can use also mysql_tquery with callback
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)