20.05.2015, 13:28
Hello, I am currently scripting a login system with MySQL R39 with Threading, and as it is my first attempt with anything with threading.. I am not currently sure on what to do however I am trying but I have found an issue with my script that I was hoping someone could help.
So the problem is.. it finds the rows and fields that are within the db however it doesn't seem to access it.
Here is the mysql_log.
Help is much appreciated, thank you.
So the problem is.. it finds the rows and fields that are within the db however it doesn't seem to access it.
Код:
stock LoginPlayer(playerid, password[]) { mysql_format(1, query, sizeof(query), "SELECT * FROM master_data WHERE Username = '%e' AND Pass = '%e'", Username(playerid), password); mysql_query(1, query); cache_get_data(rows, fields); printf("There are currently %i rows and %i fields visable in the master_data db", rows, fields); if(cache_get_row_count() > 0) { //format(query, sizeof(query), "UPDATE master_data SET LastIP = '%s' WHERE Username = '%s'", PlayerIP(playerid), Username(playerid)); //mysql_query(query); cache_get_row(rows, 4, query); if(strfind(query, "")) return query = "Create Character"; MasterData[playerid][Char0] = query; print("Char0 set"); cache_get_row(rows, 5, query); if(strfind(query, "")) return query = "Create Character"; MasterData[playerid][Char1] = query; print("Char1 set"); cache_get_row(rows, 6, query); if(strfind(query, "")) return query = "Create Character"; MasterData[playerid][Char2] = query; print("Char2 set"); //format(msg, sizeof(msg), "Welcome back %s.\nYour stats have been loaded succesfully.\nThe last login for this account was from IP: %s", PlayerName(playerid), Player_Data[playerid][Last_IP]); format(str, sizeof(str), "%s\n%s\n%s\n \nAccount Settings", MasterData[playerid][Char0], MasterData[playerid][Char1], MasterData[playerid][Char2]); ShowPlayerDialog(playerid, DIALOG_CHARSELECT, DIALOG_STYLE_LIST, "Duck's Roleplay - Account", str, "Select", "Quit"); print("Dialog should be shown here"); } else { ShowPlayerDialog(playerid, DIALOG_RETRY, DIALOG_STYLE_PASSWORD, "Duck's Roleplay - Login", "Incorrect password!\nPlease enter your account password below:", "Login", "Quit"); } return 1; }
Код:
[14:33:26] [DEBUG] mysql_connect - host: "---.-.-.-", user: "---", database: "---", password: "*---", port: ----, autoreconnect: true, pool_size: 2 [14:33:26] [DEBUG] CMySQLHandle::Create - creating new connection.. [14:33:26] [DEBUG] CMySQLHandle::CMySQLHandle - constructor called [14:33:26] [DEBUG] CMySQLHandle::Create - connection created (id: 1) [14:33:26] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [14:33:26] [DEBUG] CMySQLConnection::Connect - connection was successful [14:33:26] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [14:33:26] [DEBUG] mysql_errno - connection: 1 [14:33:26] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [14:33:26] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [14:33:26] [DEBUG] CMySQLConnection::Connect - connection was successful [14:33:26] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [14:33:26] [DEBUG] CMySQLConnection::Connect - connection was successful [14:33:26] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [14:33:26] [DEBUG] CMySQLConnection::Connect - connection was successful [14:33:26] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [14:34:03] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT Count(ID) FROM master_data WHERE Username = '%e'" [14:34:03] [DEBUG] mysql_query - connection: 1, query: "SELECT Count(ID) FROM master_data WHERE Username = 'Duck'", use_cache: true [14:34:03] [DEBUG] CMySQLQuery::Execute - starting query execution [14:34:03] [DEBUG] CMySQLQuery::Execute - query was successfully executed within 74.45 milliseconds [14:34:03] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [14:34:03] [DEBUG] CMySQLHandle::SaveActiveResult - cache saved (id: 1) [14:34:03] [DEBUG] cache_get_row_count - connection: 1 [14:34:10] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT * FROM master_data WHERE Username = '%e' AND Pass = '%e'" [14:34:10] [DEBUG] mysql_query - connection: 1, query: "SELECT * FROM master_data WHERE Username = 'Duck' AND Pass = 'pa", use_cache: true [14:34:10] [DEBUG] CMySQLQuery::Execute - starting query execution [14:34:10] [DEBUG] CMySQLQuery::Execute - query was successfully executed within 1.49 milliseconds [14:34:10] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [14:34:10] [DEBUG] CMySQLHandle::SaveActiveResult - cache saved (id: 2) [14:34:10] [DEBUG] cache_get_data - connection: 1 [14:34:10] [DEBUG] cache_get_row_count - connection: 1 [14:34:10] [DEBUG] cache_get_row - row: 1, field_idx: 4, connection: 1, max_len: 128 [14:34:10] [WARNING] CMySQLResult::GetRowData - invalid row ('1') or field index ('4')