[WARNING] CMySQLResult::GetRowData - invalid row ('0') or field index ('3')
#1

Hello. I am scripting a gamemode, but added a new feature so I thought I would like to test it all out. I deleted my account from database, and tried to register but now it simply wont send the information to the database.


I keep getting this annoying bitch:
Quote:

[01:28:31] [DEBUG] mysql_tquery - connection: 1, query: "SELECT UserID, Password FROM `Accounts` WHERE `Username` = 'Zenx", callback: "OnAccountCheck", format: "d"
[01:28:31] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - starting query execution
[01:28:31] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - query was successfully executed within 1.409 milliseconds
[01:28:31] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[01:28:31] [DEBUG] Calling callback "OnAccountCheck"..
[01:28:31] [DEBUG] cache_get_data - connection: 1
[01:28:31] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[01:28:51] [DEBUG] mysql_escape_string - source: "asd", connection: 1, max_len: 512
[01:28:51] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `Accounts` WHERE `UserID` = '0'", callback: "OnAccountLoad", format: "d"
[01:28:51] [DEBUG] CMySQLQuery::Execute[OnAccountLoad] - starting query execution
[01:28:51] [DEBUG] CMySQLQuery::Execute[OnAccountLoad] - query was successfully executed within 1.31 milliseconds
[01:28:51] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[01:28:51] [DEBUG] Calling callback "OnAccountLoad"..
[01:28:51] [DEBUG] cache_get_row_int - row: 0, field_idx: 3, connection: 1
[01:28:51] [WARNING] CMySQLResult::GetRowData - invalid row ('0') or field index ('3')
[01:28:51] [ERROR] cache_get_row_int - invalid datatype
[01:28:51] [DEBUG] cache_get_row_int - row: 0, field_idx: 4, connection: 1
[01:28:51] [WARNING] CMySQLResult::GetRowData - invalid row ('0') or field index ('4')
[01:28:51] [ERROR] cache_get_row_int - invalid datatype
[01:28:51] [DEBUG] cache_get_row_int - row: 0, field_idx: 5, connection: 1
[01:28:51] [WARNING] CMySQLResult::GetRowData - invalid row ('0') or field index ('5')
[01:28:51] [ERROR] cache_get_row_int - invalid datatype
[01:28:51] [DEBUG] cache_get_row_int - row: 0, field_idx: 6, connection: 1
[01:28:51] [WARNING] CMySQLResult::GetRowData - invalid row ('0') or field index ('6')
[01:28:51] [ERROR] cache_get_row_int - invalid datatype
[01:28:51] [DEBUG] cache_get_row_int - row: 0, field_idx: 7, connection: 1
[01:28:51] [WARNING] CMySQLResult::GetRowData - invalid row ('0') or field index ('7')
[01:28:51] [ERROR] cache_get_row_int - invalid datatype
[01:28:51] [DEBUG] cache_get_row_int - row: 0, field_idx: 8, connection: 1
[01:28:51] [WARNING] CMySQLResult::GetRowData - invalid row ('0') or field index ('8')
[01:28:51] [ERROR] cache_get_row_int - invalid datatype
[01:28:51] [DEBUG] cache_get_row_int - row: 0, field_idx: 9, connection: 1
[01:28:51] [WARNING] CMySQLResult::GetRowData - invalid row ('0') or field index ('9')
[01:28:51] [ERROR] cache_get_row_int - invalid datatype
[01:28:51] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called

and I know the issue must be that. I've searched and searched no luck.

The code to the above statement:
pawn Код:
public OnAccountLoad(playerid)
{
    UserAccount[playerid][Money] = cache_get_row_int(0, 3, MySQL);
    UserAccount[playerid][Score] = cache_get_row_int(0, 4, MySQL);
    UserAccount[playerid][Adminlevel] = cache_get_row_int(0, 5, MySQL);
    UserAccount[playerid][Viplevel] = cache_get_row_int(0, 6, MySQL);
    UserAccount[playerid][Class] = cache_get_row_int(0, 7, MySQL);
    UserAccount[playerid][RankXP] = cache_get_row_int(0, 8, MySQL);
    UserAccount[playerid][Rank] = cache_get_row_int(0, 9, MySQL);

    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, UserAccount[playerid][Money]);
    SetPlayerScore(playerid, UserAccount[playerid][Score]);
    return true;
}
My MYSQL tables (check picture). Anyway any help is very much appreciated, as it's buggs me a lot.
Reply
#2

Add in public OnAccountLoad

pawn Код:
if(!cache_num_rows()) return SendClientMessage(playerid,-1,"user id doestn exists");
and test again, probably id starts from 1 not 0 ? "WHERE `UserID` = '0'"
Reply
#3

yeah I get the user id does exists. Any suggestion for fix?
Reply
#4

Show this tquery
SELECT UserID, Password FROM `Accounts` WHERE... and OnAccountCheck callback
Reply
#5

The query you asked for:
pawn Код:
stock CheckAccount(playerid)
{
    new query[500];
    format(query, sizeof(query), "SELECT UserID, Password FROM `Accounts` WHERE `Username` = '%s' LIMIT 1", GetUser(playerid));
    mysql_function_query(MySQL, query, true, "OnAccountCheck", "d", playerid);
    return true;
}

and the OnAccountCheck callback:
pawn Код:
public OnAccountCheck(playerid)
{
    if(playerid != INVALID_PLAYER_ID)
    {
        new rows, fields;
        cache_get_data(rows, fields, MySQL);

        if(rows)
        {
            UserAccount[playerid][UserID] = cache_get_row_int(0, 0, MySQL);

            cache_get_row(0, 1, UserAccount[playerid][Password], MySQL, 130);

            new string[512];
            format(string, sizeof(string), "{FFFFFF}Welcome back to San Fierro Cops and Robbers '%s', \nTo get start playing, we must ask you to login with your personal password below.\n\n{FF0000}Note: If you do not own this account, we highly recommend you to rejoin with a new name.", GetUser(playerid));
            ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{FFFFFF}User authentication", string, "Login", "Cancel");
        }
        else
        {
            new string[512];
            format(string, sizeof(string), "{FFFFFF}Welcome to San Fierro Cops and Robbers '%s', \nTo get start playing, we must ask you to sign up with a personal password below.\nWe highly recommend, that you use an unique password for our servers.\n\n{FF0000}Note: When you have signed up, this account (%s) will be your responsiblity!", GetUser(playerid), GetUser(playerid));
            ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{FFFFFF}User authentication", string, "Register", "Cancel");
        }
    }
    return true;
}
Reply
#6

This part returns 0 ?
pawn Код:
UserAccount[playerid][UserID] = cache_get_row_int(0, 0, MySQL);
printf("UserID: %d",UserAccount[playerid][UserID]);
Reply
#7

Never mind. Just re-scripted it, and now all works. I don't see what I did wrong, but you deserve a REP for your effort. Thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)