08.01.2013, 04:05
What this code is supposed to do is display contacts that the player has added via the MySQL. Everytime the player inserts the contact it goes into the MySQL but when the player tries to view the contacts they've added, it will only display 1 contact. So it's looping through 1 result. I've tried debugging it and made it print values and it's printing the correct values but it's not looping through everything. You can see the values it prints in the image below.
Here is the image: http://i.imgur.com/jUXNu.png
Any help would be greatly appreciated!
Here is the image: http://i.imgur.com/jUXNu.png
Код:
case 1: { new string[128], data[100], contact[MAX_PLAYER_NAME], person[MAX_PLAYER_NAME], number, shit[1024];print("1"); c_NextSelection[playerid] = 0;print("2"); format(string, sizeof(string), "SELECT * FROM `contacts` WHERE `player` = '%s'", pNameEx(playerid));print("3"); mysql_query(string);print("4"); mysql_store_result();print("5"); //format(string, sizeof(string), "");print("6"); printf("rows: %d", mysql_num_rows()); if(mysql_num_rows() > 1) { while(mysql_retrieve_row()) { print("7"); mysql_fetch_row(data);printf("data: %s", data);print("8"); sscanf(data, "p<|>s[24]s[24]d", person, contact, number);print("9"); c_Selections[playerid][c_NextSelection[playerid]] = number;print("10"); c_NextSelection[playerid]++;print("11"); format(shit, sizeof(shit), "%s%s\n", shit, stringUnderscore(contact));printf("ct-ori: %s, func: %s", contact, stringUnderscore(contact));print("12"); print(shit); print("13"); } print("14"); ShowPlayerDialog(playerid, DIALOG_CONTACTS3, DIALOG_STYLE_LIST, "Contacts", shit, "Select", "Back");print("15"); print(shit); } else { print("7-ex"); mysql_fetch_row(data);printf("data: %s", data);print("8"); sscanf(data, "p<|>s[24]s[24]d", person, contact, number);print("9"); c_Selections[playerid][c_NextSelection[playerid]] = number;print("10"); c_NextSelection[playerid]++;print("11"); format(string, sizeof(string), "%s%s\n", string, stringUnderscore(contact));printf("ct-ori: %s, func: %s", contact, stringUnderscore(contact));print("12"); print(string); print("13"); ShowPlayerDialog(playerid, DIALOG_CONTACTS3, DIALOG_STYLE_LIST, "Contacts", string, "Select", "Back");print("15"); print(string); } }