Mysql: Prolem with listing rows in the database
#1

When i use the command to review the rows in the table in my database it will only show the last one and will not create anymore lines and only leaves one.

pawn Код:
CMD:reviewlist(playerid, params[], MySQL:handle)
{
    if(pData[playerid][AdminLevel] >=3)
    {
        new string[500],RequestedBy[50],Reason[75];

        format(Query,sizeof(Query),"SELECT * FROM `"/*remove for samp forums*/"`");
        mysql_query(Query);
        mysql_store_result();
       
        while(mysql_fetch_row_format(Query, "|"))
        {
            mysql_fetch_field_row(RequestedBy, "RequestedBy");
            mysql_fetch_field_row(Reason, "Reason");
            format(string,sizeof(string),"(id) Name: %s - Reason: %s\n",RequestedBy,Reason);
        }
        mysql_free_result();
        ShowPlayerDialog(playerid,1135,DIALOG_STYLE_LIST, "{ff6600}System", string,"Close","");
       
    } else {
   
   
    }
}
Reply
#2

The string named 'string' is just re-writing over itself over and over.

pawn Код:
format(string,sizeof(string),"(id) Name: %s - Reason: %s\n",RequestedBy,Reason);
Is meant to be
pawn Код:
format(string,sizeof(string),"%s(id) Name: %s - Reason: %s\n",string,RequestedBy,Reason);
.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)