05.05.2013, 15:38
I'm trying to retrieve all the names of players within a certain faction via MySQL and place them in a list dialog. Here's what I have:
And it works - sometimes. In some instances it will return all players in the faction, and others only display one or two random names that are in it. I can't figure out the source of these inconsistencies, any help?
pawn Код:
new name[32],res[32],str1[800],query[256],fid=editingfaction[playerid];
format(query,sizeof(query),"SELECT * FROM users WHERE Faction = '%i'",fid);
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row_format(query,"|")) {
mysql_fetch_field_row(res, "AccountName");
format(name,sizeof(name),"%s\n",res);
strcat(str1,name,800);
}
mysql_free_result();
ShowPlayerDialog(playerid,DIALOG_FACTIONMEMBERS,DIALOG_STYLE_LIST,"Faction management",str1,"Select","Back");