[MySQL] Loading a variable.
#1

Hey all,

This is what I am doing to store a variable:
pawn Код:
PlayerInfo[playerid][pSkillSelected] = 1;
mysql_format(mysql, f_query, sizeof(f_query), "UPDATE playerdata SET SkillSelected='%i' WHERE name='%s'", PlayerInfo[playerid][pSkillSelected], PlayerInfo[playerid][name]);
mysql_tquery(mysql, f_query, "", "");
And now I want to load this variable:
pawn Код:
forward LoadAccount(playerid);
public LoadAccount(playerid)
{
    new rows = cache_num_rows();
    if(!rows) {
        printf("[DATABASE ERROR]: Account does not exist.");
    }
    else if(rows == 1) {
        cache_get_field_content(0, "IP", PlayerInfo[playerid][IP], mysql, 17);
        cache_get_field_content(0, "Sex", PlayerInfo[playerid][pSex], mysql);
        cache_get_field_content(0, "Age", PlayerInfo[playerid][pAge], mysql);
        cache_get_field_content(0, "Medic", PlayerInfo[playerid][pAthelete], mysql);
        cache_get_field_content(0, "Mechanic", PlayerInfo[playerid][pMechanic], mysql);
        cache_get_field_content(0, "Pilot", PlayerInfo[playerid][pPilot], mysql);
        cache_get_field_content(0, "SkillSelected", PlayerInfo[playerid][pSkillSelected]);
    }
    else if(rows > 1) {
        printf("[DATABASE ERROR]: Multiple accounts matching player %d.", playerid);
    }
}
And I want to use that result here:
pawn Код:
if(PlayerInfo[playerid][pSkillSelected] != 1)
{
        ShowPlayerDialog(playerid, DIALOG_SKILL, DIALOG_STYLE_LIST, "Select the skill you want your chracter to have","Medic\nAthlete\nPilot\nMechanic","Select","Quit");
        print("yeah!");
}
But it is showing me the dialog and printing 'yeah'.

Am I doing it right?
Reply


Messages In This Thread
[MySQL] Loading a variable. - by Faisal_khan - 12.06.2014, 18:27
Re: [MySQL] Loading a variable. - by Patrick - 12.06.2014, 18:34
Re: [MySQL] Loading a variable. - by Faisal_khan - 12.06.2014, 18:39
Re: [MySQL] Loading a variable. - by Patrick - 12.06.2014, 18:41
Re: [MySQL] Loading a variable. - by Faisal_khan - 12.06.2014, 18:50
Re: [MySQL] Loading a variable. - by xo - 12.06.2014, 19:08
Re: [MySQL] Loading a variable. - by Faisal_khan - 12.06.2014, 19:11
Re: [MySQL] Loading a variable. - by xo - 13.06.2014, 00:32
Re: [MySQL] Loading a variable. - by Faisal_khan - 13.06.2014, 08:20
Re: [MySQL] Loading a variable. - by Faisal_khan - 13.06.2014, 08:50

Forum Jump:


Users browsing this thread: 3 Guest(s)