SA-MP Forums Archive
Problem ORM [+rep] - 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: Problem ORM [+rep] (/showthread.php?tid=560951)



Problem ORM [+rep] - Z3N0N - 31.01.2015

Hi,
My ORM does not work, it does not load yet nothing all looks good ... Thank you.

PHP код:
new _query[128];
mysql_format(connectSQL, _query, sizeof(_query), "SELECT * FROM `account` WHERE `Name` = '%e'", returnName(playerid));
mysql_tquery(connectSQL, _query, "OnPlayerDataLoad", "d", playerid);
public 
OnPlayerDataLoad(playerid)
{
        
    if(
cache_num_rows() == 1)
    {
           new 
ORM:ormid = pInfo[playerid][pORM_ID] = orm_create("account");
        
orm_addvar_int(ormid, pInfo[playerid][pID], "ID");
        
orm_addvar_int(ormid, pInfo[playerid][pAdmin], "AdminLevel");
        
orm_addvar_int(ormid, pInfo[playerid][pLevel], "Level");
        
orm_addvar_int(ormid, pInfo[playerid][pRespect], "Respect");
        
orm_addvar_int(ormid, pInfo[playerid][pBank], "Bank");
        
orm_addvar_int(ormid, pInfo[playerid][pSex], "Sex");
        
orm_addvar_int(ormid, pInfo[playerid][pOrigin], "Origin");
        
orm_addvar_int(ormid, pInfo[playerid][pSkin], "Skin");
        
orm_addvar_int(ormid, pInfo[playerid][pBanTime], "BanTime");
        
        
orm_addvar_string(ormid, pInfo[playerid][pPassword], 248, "Password");
        
orm_addvar_string(ormid, pInfo[playerid][pName], MAX_PLAYER_NAME+1, "Name");
        
orm_addvar_string(ormid, pInfo[playerid][pEmail], 248, "Email");
        
orm_addvar_string(ormid, pInfo[playerid][pDescription], 248, "Description");
        
orm_addvar_string(ormid, pInfo[playerid][pBanReason], 248, "BanReason");
        
orm_setkey(ormid, "Name");
        
dialogShow(playerid, connectPlayer, DIALOG_STYLE_PASSWORD, "{0197D8}Connexion а votre compte", "{FEFEFE}Salut ! Merci d'entrer ton mot de passe dans la case ci-dessous, vous avez le droit а un maximum de 5 essais, sinon vous aurez un bannissement de 5 heures sans possibilitй d'unban manuellement.", "Connexion", "Dйconnexion");
    }
    
orm_setkey(pInfo[playerid][pORM_ID], "ID");
    return 
true;
}[
B][/B] 



Re: Problem ORM [+rep] - StasWilson - 31.01.2015

mysql_log eat?


Re : Problem ORM [+rep] - Z3N0N - 31.01.2015

Код:
[22:07:36] [WARNING] cache_get_row_count - no active cache
[22:13:06] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Name")
[22:13:06] [WARNING] CMySQLResult::GetRowDataByName - field not found ("AdminLevel")
[22:13:06] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Level")
[22:13:06] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Respect")
[22:13:06] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Bank")
[22:13:06] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Sex")
[22:13:06] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Origin")
[22:13:06] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Skin")
[22:13:06] [WARNING] CMySQLResult::GetRowDataByName - field not found ("BanTime")
[22:13:06] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Password")
[22:13:06] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Email")
[22:13:06] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Description")
[22:13:06] [WARNING] CMySQLResult::GetRowDataByName - field not found ("BanReason")
[22:15:39] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Name")
[22:15:39] [WARNING] CMySQLResult::GetRowDataByName - field not found ("AdminLevel")
[22:15:39] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Level")
[22:15:39] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Respect")
[22:15:39] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Bank")
[22:15:39] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Sex")
[22:15:39] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Origin")
[22:15:39] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Skin")
[22:15:39] [WARNING] CMySQLResult::GetRowDataByName - field not found ("BanTime")
[22:15:39] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Password")
[22:15:39] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Email")
[22:15:39] [WARNING] CMySQLResult::GetRowDataByName - field not found ("Description")
[22:15:39] [WARNING] CMySQLResult::GetRowDataByName - field not found ("BanReason")
Yet these fields exist.


Re: Problem ORM [+rep] - StasWilson - 31.01.2015

Quote:

forward LoginCallback(playerid);

new nickname[MAX_PLAYER_NAME];
GetPlayerName(playerid,nickname, MAX_PLAYER_NAME);
new query_m[128];
mysql_format(DBHandle, query_m, sizeof(query_m), "SELECT * FROM `account` WHERE `Name` = '%e'",nickname);
mysql_tquery(DBHandle, query_m, "LoginCallback","i", playerid);

example 1:
public LoginCallback(playerid)
{
new ORMrmid = PlayerInfo[playerid][ORM_ID] = orm_create("account");
orm_addvar_int(ormid, PlayerInfo[playerid][pMYSQLID], "ID");
orm_addvar_string(ormid, PlayerInfo[playerid][pName], MAX_PLAYER_NAME, "Name");
orm_setkey(ormid, "Name");
orm_addvar_string(ormid, PlayerInfo[playerid][pPassword], 64, "Password");
orm_addvar_int(ormid, PlayerInfo[playerid][pSex], "Sex");
return 1;
}

example 2 :

public LoginCallback(playerid)
{
new ORMrmid = PlayerInfo[playerid][ORM_ID] = orm_create("account");
orm_addvar_int(ormid, PlayerInfo[playerid][pMYSQLID], "ID");
orm_addvar_string(ormid, PlayerInfo[playerid][pName], MAX_PLAYER_NAME, "Name");
orm_setkey(ormid, "Name");
orm_addvar_string(ormid, PlayerInfo[playerid][pPassword], 64, "Password");
orm_addvar_int(ormid, PlayerInfo[playerid][pSex], "Sex");
//
orm_apply_cache(ormid, 0);
return 1;
}

Maybe it will help you


Re : Problem ORM [+rep] - Z3N0N - 31.01.2015

no load :/

PHP код:
           new ORM:ormid = pInfo[playerid][pORM_ID] = orm_create("account");
           
        
orm_addvar_string(ormid, pInfo[playerid][pName], MAX_PLAYER_NAME+1, "Name");
        
orm_setkey(ormid, "Name");
        
orm_addvar_string(ormid, pInfo[playerid][pPassword], 248, "Password");
        
orm_addvar_string(ormid, pInfo[playerid][pName], MAX_PLAYER_NAME+1, "Name");
        
orm_addvar_string(ormid, pInfo[playerid][pEmail], 248, "Email");
        
orm_addvar_string(ormid, pInfo[playerid][pDescription], 248, "Description");
        
orm_addvar_string(ormid, pInfo[playerid][pBanReason], 248, "BanReason");

        
orm_addvar_int(ormid, pInfo[playerid][pID], "ID");
        
orm_addvar_int(ormid, pInfo[playerid][pAdmin], "AdminLevel");
        
orm_addvar_int(ormid, pInfo[playerid][pLevel], "Level");
        
orm_addvar_int(ormid, pInfo[playerid][pRespect], "Respect");
        
orm_addvar_int(ormid, pInfo[playerid][pBank], "Bank");
        
orm_addvar_int(ormid, pInfo[playerid][pSex], "Sex");
        
orm_addvar_int(ormid, pInfo[playerid][pOrigin], "Origin");
        
orm_addvar_int(ormid, pInfo[playerid][pSkin], "Skin");
        
orm_addvar_int(ormid, pInfo[playerid][pBanTime], "BanTime");
        
orm_apply_cache(ormid, 0); 



Re: Problem ORM [+rep] - StasWilson - 31.01.2015

You have no tables or cells


Re : Problem ORM [+rep] - Z3N0N - 31.01.2015




Re: Problem ORM [+rep] - StasWilson - 31.01.2015

Do not re-created orm_addvar_string, orm_addvar_int

(SELECT `add the values that you want to read or create sequences from ID`)

EXAMPLE 1

SELECT `ID`, `Nickname`, `Password` ....

Example 2

SELECT * - Load all




mysql_format(DBHandle, query_m, sizeof(query_m), "SELECT * FROM `account` WHERE `Name` = '%e'",nickname);
mysql_tquery(DBHandle, query_m, "LoginCallback","i", playerid);


Re: Problem ORM [+rep] - StasWilson - 31.01.2015

and check the connection to mysql


Re : Problem ORM [+rep] - Z3N0N - 31.01.2015

I did not understand sorry: / The connection is not good if it will launch.