Dialog list with multiple result from query
#1

Hi I need to create a dialog list with data drawn from a sql query only that I can not understand how to do with this code shows me only the last result of the query while I need to show them all the code is this:

PHP код:
forward GetSkinsForPlayer(playerid);
public 
GetSkinsForPlayer(playerid)
{
    new 
rowsrazzaagefat,agedsexdialogo[1024];
    
razza 1
    
age pInfo[playerid][pAge];
    
sex pInfo[playerid][pSex];
    
aged age+5;
    
fat 0
    
cache_get_row_count(rows);
    if(
rows)
    {
        new 
s_models_ages_razzas_fat;
        for(new 
ii<rowsi++)
        {
            
cache_get_value_int(i"skinModel"s_model);
            
cache_get_value_int(i"skinAge"s_age);
            
cache_get_value_int(i"skinRazza"s_razza);
            
cache_get_value_int(i"skinFat"s_fat);
            
printf("Skin Model ID: %d - Age: %d - Razza: %d - Fat: %d ",s_models_ages_razzas_fat);
            
format(dialogosizeof(dialogo), "[%d] Modello Skin: %d - Etа: %d - %d\n",i,s_models_ageaged);
        }
        
ShowPlayerDialog(playeridDIALOG_SKIN_SELECTDIALOG_STYLE_LIST"Seleziona Skin"dialogo"Scegli""Chiudi");
    }
    return 
true;

Sorry for my bad english
Reply
#2

You have to create two strings and use strcat

Код:
new str1[512], str2[100];
//loop
format(str2, sizeof str2, ...);
strcat(str1, str2);
In your code, you format actual row, but the row before is overwritten.
Reply
#3

Thanks so much rep +
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)