mysql_tquery(mysql, "SELECT `fName` FROM `factions` ORDER BY `fID` ASC", "ListFactions", "i", playerid);
forward ListFactions(playerid); public ListFactions(playerid) { new count = 0, rows, fields; cache_get_data(rows, fields, mysql); printf("start of list"); if(rows) { printf("if rows:%i", rows); new facname[MAX_FACTIONS][50], faclist[300]; while(count < rows) { cache_get_field_content(0, "fName", facname[count], mysql, 255); format(faclist, sizeof(faclist), "%s%s\n", faclist, facname[count]); printf("facname:%s count:%i rows:%i", facname[count], count, rows); count++; } return ShowPlayerDialog(playerid, DIALOG_FACTION_LIST, DIALOG_STYLE_LIST, "List Factions", faclist, "Okay", ""); } else { SendErrorMessage(playerid, "There are no factions."); return cmd_factions(playerid, ""); } }
[11:35:22] start of list [11:35:22] if rows:3 [11:35:22] facname:Los Santos Police Department count:0 rows:3 [11:35:22] facname:Los Santos Police Department count:1 rows:3 [11:35:22] facname:Los Santos Police Department count:2 rows:3
cache_get_field_content(0, ...
If you know the number of iterations you should use a for-loop. But your actual problem is that you're always accessing row 0.
Код:
cache_get_field_content(0, ... |