Query help
#1

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:

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");
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?
Reply
#2

ShowPlayerDialog should be after strcat and before mysql_free_result.
Reply
#3

Same results :/
Reply
#4

Bump. Kamzaf's solution fixed it but it started happening again shortly after.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)