14.08.2011, 00:21
I have a table in the MySQL database called "factions' it stores all the faction variables. Is there a way I could load all these variables in one query? Here is what I need to put the variables into:
Then I have the public to load factions:
Under the callback currently I have:
Код:
enum fInfo { File[14], Name[256], Rank1[32], Rank2[32], Rank3[32], Rank4[32], Rank5[32], Rank6[32], Rank7[32], Rank8[32], Rank9[32], Rank10[32], Float:ExtX, Float:ExtY, Float:ExtZ, Float:ExtA, Float:IntX, Float:IntY, Float:IntZ, Float:IntA, Interior, World } new FactionInfo[FACTION_MAX][fInfo];
Код:
LoadFaction() { for(new i = 0; i < FACTION_MAX; i++) { // Place to load crap... } }
Код:
public LoadFactions() { for(new i = 0; i < FACTION_MAX; i++) { new query[256]; format(query, 256, "SELECT * FROM factions WHERE ID = '%i' LIMIT 1", i); mysql_store_result(); while(mysql_retrieve_row()) { mysql_fetch_field_row(FactionInfo[i][Name], "Name"); mysql_fetch_field_row(FactionInfo[i][Rank1], "Rank1"); mysql_fetch_field_row(FactionInfo[i][Rank2], "Rank2"); mysql_fetch_field_row(FactionInfo[i][Rank3], "Rank3"); mysql_fetch_field_row(FactionInfo[i][Rank4], "Rank4"); mysql_fetch_field_row(FactionInfo[i][Rank5], "Rank5"); mysql_fetch_field_row(FactionInfo[i][Rank6], "Rank6"); mysql_fetch_field_row(FactionInfo[i][Rank7], "Rank7"); mysql_fetch_field_row(FactionInfo[i][Rank8], "Rank8"); mysql_fetch_field_row(FactionInfo[i][Rank9], "Rank9"); mysql_fetch_field_row(FactionInfo[i][Rank10], "Rank10"); mysql_free_result(); } } }