SQL only shows 1 result
#1

pawn Код:
forward OnPrison_Check(playerid);
public OnPrison_Check(playerid){
    new rows, fields, officer, timestamp, time, year, month, day, hour, minute, second, cstr[1024];
    cache_get_data(rows, fields, sqlConnection);
   
    if(!cache_num_rows()){ format(cstr, sizeof(cstr), "No records to display."); }
   
    for(new i = 0; i <= cache_num_rows(); i++){
        officer = cache_get_field_content_int(i, "officerID", sqlConnection);
        timestamp = cache_get_field_content_int(i, "timeStamp", sqlConnection);
        time = cache_get_field_content_int(i, "Length", sqlConnection);
       
        timeToDate(timestamp, hour, minute, second, year, month, day);
        format(cstr, sizeof(cstr), "%s[%02d/%02d | %02d:%02d - (%02d minutes)] - By %s\n", cstr, day, month, hour, minute, time, GetPlayerNameFromSQL(officer));
    }
   
    format(str, sizeof(str), "%s - Arrest Log", mdcPlayer[playerid]);
    ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_LIST, str, cstr, "Ok", "");
    return 1;
}
It only displays the first in the database.

query is:

pawn Код:
mysql_format(sqlConnection, query, sizeof(query), "SELECT * FROM `prisons` WHERE `playerID`=%d", GetPlayerIDFromSQL(mdcPlayer[playerid]));
mysql_pquery(sqlConnection, query, "OnPrison_Check", "i", playerid);
Reply
#2

Extra from the mysql_log

In callback "OnPrison_Check"
19:56:51 cache_get_row_count WARNING no active cache
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)