[MySQL] What is happening?
#1

Hi,

I have some code which has worked perfectly fine.. and all of a sudden it has just stopped working and just gives out blank results..

code
Код:
public OnPlayerCharacterSelection(playerid) {
   #if TESTSERVER == true
      print("OnPlayerCharacterSelection Called.");
   #endif
   MySQL::getData(rows, fields);
   printf("Rows: %i", rows);
   for(new i = 0; i < rows; i++) {
      MySQL::storeString(i, 1, Temp[i][0]);
      if(strfind(Temp[i], "null", true) != -1) strcat((Temp[i][0] = EOS, Temp[i]), "Create Character", 17);
   }
   format(str, sizeof(str), "%s\n%s\n%s", Temp[0], Temp[1], Temp[2]);
   ShowPlayerDialog(playerid, DIALOG_ACCOUNT, DIALOG_STYLE_LIST, ""SVR_NAME" - Account", str, DIALOG_BUTTON_SELECT, DIALOG_BUTTON_EXIT);
}
mysql_log.txt
Код:
[16:43:08] [DEBUG] mysql_format - connection: 1, len: 450, format: "SELECT Username FROM playerdata WHERE ID IN(%i, %i, %i) ORDER BY ID ASC"
[16:43:08] [DEBUG] mysql_tquery - connection: 1, query: "SELECT Username FROM playerdata WHERE ID IN(1, 2, 0) ORDER BY ID", callback: "OnPlayerCharacterSelection", format: "i"
[16:43:08] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[16:43:08] [DEBUG] CMySQLQuery::Execute[OnPlayerCharacterSelection] - starting query execution
[16:43:08] [DEBUG] CMySQLQuery::Execute[OnPlayerCharacterSelection] - query was successfully executed within 3.37 milliseconds
[16:43:08] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[16:43:08] [DEBUG] Calling callback "OnPlayerCharacterSelection"..
[16:43:08] [DEBUG] cache_get_data - connection: 1
[16:43:08] [DEBUG] cache_get_row - row: 0, field_idx: 1, connection: 1, max_len: 1
[16:43:08] [WARNING] CMySQLResult::GetRowData - invalid row ('0') or field index ('1')
[16:43:08] [DEBUG] cache_get_row - row: 1, field_idx: 1, connection: 1, max_len: 1
[16:43:08] [WARNING] CMySQLResult::GetRowData - invalid row ('1') or field index ('1')
It is supposed to display the users characters that they have stored between two different tables, I have checked the code and the database and I have debugged the server with print, the print shows that there are 2 rows, which is correct however in the mysql log, says that there are no rows or fields.. which isn't right..

I'm clearly not smart enough to figure this out.. or just haven't looked hard enough so could someone point out what is happening?
Reply
#2

Fields start from 0 not 1.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Fields start from 0 not 1.
I know, but I am trying to get the data in the second field
Reply
#4

Quote:
Originally Posted by MotherDucker
Посмотреть сообщение
I know, but I am trying to get the data in the second field
You don't have a second field:
pawn Код:
"SELECT Username FROM playerdata WHERE ID IN(1, 2, 0) ORDER BY ID"
Username is the field id 0. Trying to retrieve from field id 1 will give the warning.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)