Mysql: Prolem with listing rows in the database - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Mysql: Prolem with listing rows in the database (
/showthread.php?tid=460298)
Mysql: Prolem with listing rows in the database -
zT KiNgKoNg - 27.08.2013
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 {
}
}
Re: Mysql: Prolem with listing rows in the database -
[HiC]TheKiller - 28.08.2013
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);

.