SA-MP Forums Archive
SetVariableAsKey - variable not found - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SetVariableAsKey - variable not found (/showthread.php?tid=503766)



SetVariableAsKey - variable not found - Mado - 31.03.2014

I'm using BlueG's MySQL plugin (R3 and I am using ORM for queries. At a specific part of my script I receive these error messages:

[02:54:12] [ERROR] COrm::SetVariableAsKey - variable not found
[02:54:12] [ERROR] COrm::GenerateSelectQuery - invalid key or connection handle

This is the part of the script:
pawn Код:
new ORM:ormid = PlayerInfo[playerid][ORM_ID] = orm_create("Players");
   
    orm_setkey(ormid, "pName");
    orm_select(ormid, "DoesAccountExist", "s", playerid);
This is placed at at OnPlayerConnect


This is the function DoesAccountExist
pawn Код:
forward DoesAccountExist(playerid);
public DoesAccountExist(playerid)
{
    print("in function");
    switch(orm_errno(PlayerInfo[playerid][ORM_ID]))
    {
        case ERROR_OK: {
            ShowPlayerDialog(playerid, DIALOG_REGISTER_1, DIALOG_STYLE_PASSWORD, "Log In", "blabla.", "Log in", "Cancel");
            print("1");
        }
        case ERROR_NO_DATA: {
            ShowPlayerDialog(playerid, DIALOG_REGISTER_1, DIALOG_STYLE_PASSWORD, "Register", "blabla.", "Register", "Abort");
            print("2");
        }
    }
    print("switch done");
    orm_setkey(PlayerInfo[playerid][ORM_ID], "ID");
    return 1;
}
- I am using the most recent version (R3 of the script
- The plugin matches the include
- The column "pName" exists in the MySQL database


Re: SetVariableAsKey - variable not found - RenovanZ - 31.03.2014

pawn Код:
orm_select(ormid, "DoesAccountExist", "d", playerid);
Should be "d" not "s"


Re: SetVariableAsKey - variable not found - Mado - 31.03.2014

I had that fixed already, still doesn't work..


Re: SetVariableAsKey - variable not found - Mado - 31.03.2014

I've tried several things in an attempt to fix it.. I renamed the variable name (also in the database), it did not work.

Also I tried if the connection was working correctly and it did... I can't seem to find a solution.