MySQL Not Updating!
#1

Hi all, I currently on progress making GM with MySQL, but, why my GM wont updating the database?
I've made this function
pawn Код:
stock ScythSaveAccount(playerid)
{
    new query[10000], Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
    ScythSafeUpdating();
   
    format(query, sizeof(query), "UPDATE `users` SET \
        `Registered` = %d, \
        `RegisterStep` = %d, \
        `Gender` = %d, \
        `Date1` = %d, \
        `Date2` = %d, \
        `Date3` = %d, \
        `Age` = %d, \
        `Origin` = '%s', \
        `Dollars` = %d, \
        `Cents` = %d, \
        `Level` = %d, \
        `Health` = %f, \
        `Armor` = %f, \
        `Clothes` = %d, \
        `PosX` = %f, \
        `PosY` = %f, \
        `PosZ` = %f, \
        `PosR` = %f,"
,
        PlayerInfo[playerid][pRegistered],
        PlayerInfo[playerid][pRegstep],
        PlayerInfo[playerid][pGender],
        PlayerInfo[playerid][pDate][0],
        PlayerInfo[playerid][pDate][1],
        PlayerInfo[playerid][pDate][2],
        PlayerInfo[playerid][pAge],
        ScythReturnEscaped(PlayerInfo[playerid][pOrigin]),
        PlayerInfo[playerid][pDollars],
        PlayerInfo[playerid][pCents],
        PlayerInfo[playerid][pLevel],
        PlayerInfo[playerid][pHealth],
        PlayerInfo[playerid][pArmor],
        PlayerInfo[playerid][pClothes],
        PlayerInfo[playerid][pPosX],
        PlayerInfo[playerid][pPosY],
        PlayerInfo[playerid][pPosZ],
        PlayerInfo[playerid][pPosR]
    );
   
    format(query, sizeof(query), "%s \
        `IP` = '%s', \
        `VirtualWorld` = %d, \
        `Interior` = %d, \
        `AdminLevel` = %d, \
        `Account` = %d, \
        `Balance1` = %d, \
        `Balance2` = %d, \
        `Job` = %d, \
        `Duty` = %d, \
        `Salary1` = %d, \
        `Salary2` = %d \
        WHERE `Username` = '%s'"
,
        query,
        PlayerInfo[playerid][pIP],
        PlayerInfo[playerid][pVW],
        PlayerInfo[playerid][pInt],
        PlayerInfo[playerid][pAdmin],
        PlayerInfo[playerid][pAccount],
        PlayerInfo[playerid][pBalance][0],
        PlayerInfo[playerid][pBalance][1],
        PlayerInfo[playerid][pJob],
        PlayerInfo[playerid][pDuty],
        PlayerInfo[playerid][pSalary][0],
        PlayerInfo[playerid][pSalary][1],
        Name
    );

    mysql_query(query);
    print("called");
    return 1;
}
As you can see, I trying to print, but its not called.
Reply
#2

Why do you call the function again?

Remove:
pawn Код:
ScythSafeUpdating();
and seriously?
pawn Код:
new query[10000]
change it to
pawn Код:
new query[150];
Reply
#3

Quote:
Originally Posted by -Prodigy-
Посмотреть сообщение
Why do you call the function again?

Remove:
pawn Код:
ScythSafeUpdating();
and seriously?
pawn Код:
new query[10000]
change it to
pawn Код:
new query[150];
Im not repeat calling function, but im doing Safe Update.
pawn Код:
stock ScythSafeUpdating()
{
    mysql_query("SET SQL_SAFE_UPDATES=0;");
    return 1;
}
Reply
#4

Why
do
you
split
the
lines
like
this?

Doesn't
it
make
it
very
hard
to
read?
Reply
#5

Try this:
pawn Код:
stock ScythSaveAccount(playerid)
{
    new query[512], query2[512], Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
    ScythSafeUpdating();
   
    format(query, sizeof(query), "UPDATE `users` SET \
        `Registered` = %d, \
        `RegisterStep` = %d, \
        `Gender` = %d, \
        `Date1` = %d, \
        `Date2` = %d, \
        `Date3` = %d, \
        `Age` = %d, \
        `Origin` = '%s', \
        `Dollars` = %d, \
        `Cents` = %d, \
        `Level` = %d, \
        `Health` = %f, \
        `Armor` = %f, \
        `Clothes` = %d, \
        `PosX` = %f, \
        `PosY` = %f, \
        `PosZ` = %f, \
        `PosR` = %f,"
,
        PlayerInfo[playerid][pRegistered],
        PlayerInfo[playerid][pRegstep],
        PlayerInfo[playerid][pGender],
        PlayerInfo[playerid][pDate][0],
        PlayerInfo[playerid][pDate][1],
        PlayerInfo[playerid][pDate][2],
        PlayerInfo[playerid][pAge],
        ScythReturnEscaped(PlayerInfo[playerid][pOrigin]),
        PlayerInfo[playerid][pDollars],
        PlayerInfo[playerid][pCents],
        PlayerInfo[playerid][pLevel],
        PlayerInfo[playerid][pHealth],
        PlayerInfo[playerid][pArmor],
        PlayerInfo[playerid][pClothes],
        PlayerInfo[playerid][pPosX],
        PlayerInfo[playerid][pPosY],
        PlayerInfo[playerid][pPosZ],
        PlayerInfo[playerid][pPosR]
    );
   
    format(query2, sizeof(query2), "%s \
        `IP` = '%s', \
        `VirtualWorld` = %d, \
        `Interior` = %d, \
        `AdminLevel` = %d, \
        `Account` = %d, \
        `Balance1` = %d, \
        `Balance2` = %d, \
        `Job` = %d, \
        `Duty` = %d, \
        `Salary1` = %d, \
        `Salary2` = %d \
        WHERE `Username` = '%s'"
,
        query,
        PlayerInfo[playerid][pIP],
        PlayerInfo[playerid][pVW],
        PlayerInfo[playerid][pInt],
        PlayerInfo[playerid][pAdmin],
        PlayerInfo[playerid][pAccount],
        PlayerInfo[playerid][pBalance][0],
        PlayerInfo[playerid][pBalance][1],
        PlayerInfo[playerid][pJob],
        PlayerInfo[playerid][pDuty],
        PlayerInfo[playerid][pSalary][0],
        PlayerInfo[playerid][pSalary][1],
        Name
    );
    strcat(query, query2);
    mysql_query(query);
    print("called");
    return 1;
}
Reply
#6

Quote:
Originally Posted by Sk1lleD
Посмотреть сообщение
Try this:
Код:
stock ScythSaveAccount(playerid)
{
    new query[512], query2[512], Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
    ScythSafeUpdating();
    
    format(query, sizeof(query), "UPDATE `users` SET \
        `Registered` = %d, \
        `RegisterStep` = %d, \
        `Gender` = %d, \
        `Date1` = %d, \
        `Date2` = %d, \
        `Date3` = %d, \
        `Age` = %d, \
        `Origin` = '%s', \
        `Dollars` = %d, \
        `Cents` = %d, \
        `Level` = %d, \
        `Health` = %f, \
        `Armor` = %f, \
        `Clothes` = %d, \
        `PosX` = %f, \
        `PosY` = %f, \
        `PosZ` = %f, \
        `PosR` = %f,",
        PlayerInfo[playerid][pRegistered],
        PlayerInfo[playerid][pRegstep],
        PlayerInfo[playerid][pGender],
        PlayerInfo[playerid][pDate][0],
        PlayerInfo[playerid][pDate][1],
        PlayerInfo[playerid][pDate][2],
        PlayerInfo[playerid][pAge],
        ScythReturnEscaped(PlayerInfo[playerid][pOrigin]),
        PlayerInfo[playerid][pDollars],
        PlayerInfo[playerid][pCents],
        PlayerInfo[playerid][pLevel],
        PlayerInfo[playerid][pHealth],
        PlayerInfo[playerid][pArmor],
        PlayerInfo[playerid][pClothes],
        PlayerInfo[playerid][pPosX],
        PlayerInfo[playerid][pPosY],
        PlayerInfo[playerid][pPosZ],
        PlayerInfo[playerid][pPosR]
    );
    
    format(query2, sizeof(query2), "%s \
        `IP` = '%s', \
        `VirtualWorld` = %d, \
        `Interior` = %d, \
        `AdminLevel` = %d, \
        `Account` = %d, \
        `Balance1` = %d, \
        `Balance2` = %d, \
        `Job` = %d, \
        `Duty` = %d, \
        `Salary1` = %d, \
        `Salary2` = %d \
        WHERE `Username` = '%s'",
        query,
        PlayerInfo[playerid][pIP],
        PlayerInfo[playerid][pVW],
        PlayerInfo[playerid][pInt],
        PlayerInfo[playerid][pAdmin],
        PlayerInfo[playerid][pAccount],
        PlayerInfo[playerid][pBalance][0],
        PlayerInfo[playerid][pBalance][1],
        PlayerInfo[playerid][pJob],
        PlayerInfo[playerid][pDuty],
        PlayerInfo[playerid][pSalary][0],
        PlayerInfo[playerid][pSalary][1],
        Name
    );
    strcat(query, query2);
    mysql_query(query);
    print("called");
    return 1;
}
not work.
Reply
#7

uhm... put
printf(query);
and tell me what he writes when the funcition is called

EDIT:
I haven't seen an error D:
check this
[code]
Код:
stock ScythSaveAccount(playerid)
{
    new query[512], query2[512], Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
    ScythSafeUpdating();
    
    format(query, sizeof(query), "UPDATE `users` SET \
        `Registered` = %d, \
        `RegisterStep` = %d, \
        `Gender` = %d, \
        `Date1` = %d, \
        `Date2` = %d, \
        `Date3` = %d, \
        `Age` = %d, \
        `Origin` = '%s', \
        `Dollars` = %d, \
        `Cents` = %d, \
        `Level` = %d, \
        `Health` = %f, \
        `Armor` = %f, \
        `Clothes` = %d, \
        `PosX` = %f, \
        `PosY` = %f, \
        `PosZ` = %f, \
        `PosR` = %f,",
        PlayerInfo[playerid][pRegistered],
        PlayerInfo[playerid][pRegstep],
        PlayerInfo[playerid][pGender],
        PlayerInfo[playerid][pDate][0],
        PlayerInfo[playerid][pDate][1],
        PlayerInfo[playerid][pDate][2],
        PlayerInfo[playerid][pAge],
        ScythReturnEscaped(PlayerInfo[playerid][pOrigin]),
        PlayerInfo[playerid][pDollars],
        PlayerInfo[playerid][pCents],
        PlayerInfo[playerid][pLevel],
        PlayerInfo[playerid][pHealth],
        PlayerInfo[playerid][pArmor],
        PlayerInfo[playerid][pClothes],
        PlayerInfo[playerid][pPosX],
        PlayerInfo[playerid][pPosY],
        PlayerInfo[playerid][pPosZ],
        PlayerInfo[playerid][pPosR]
    );
    
    format(query2, sizeof(query2), "`IP` = '%s', \
        `VirtualWorld` = %d, \
        `Interior` = %d, \
        `AdminLevel` = %d, \
        `Account` = %d, \
        `Balance1` = %d, \
        `Balance2` = %d, \
        `Job` = %d, \
        `Duty` = %d, \
        `Salary1` = %d, \
        `Salary2` = %d \
        WHERE `Username` = '%s'",
        PlayerInfo[playerid][pIP],
        PlayerInfo[playerid][pVW],
        PlayerInfo[playerid][pInt],
        PlayerInfo[playerid][pAdmin],
        PlayerInfo[playerid][pAccount],
        PlayerInfo[playerid][pBalance][0],
        PlayerInfo[playerid][pBalance][1],
        PlayerInfo[playerid][pJob],
        PlayerInfo[playerid][pDuty],
        PlayerInfo[playerid][pSalary][0],
        PlayerInfo[playerid][pSalary][1],
        Name
    );
    strcat(query, query2);
    mysql_query(query);
    print("called");
    printf(query);
    return 1;
}
Reply
#8

Quote:
Originally Posted by Sk1lleD
Посмотреть сообщение
uhm... put
printf(query);
and tell me what he writes when the funcition is called

EDIT:
I haven't seen an error D:
check this
[code]
Код:
stock ScythSaveAccount(playerid)
{
    new query[512], query2[512], Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
    ScythSafeUpdating();
    
    format(query, sizeof(query), "UPDATE `users` SET \
        `Registered` = %d, \
        `RegisterStep` = %d, \
        `Gender` = %d, \
        `Date1` = %d, \
        `Date2` = %d, \
        `Date3` = %d, \
        `Age` = %d, \
        `Origin` = '%s', \
        `Dollars` = %d, \
        `Cents` = %d, \
        `Level` = %d, \
        `Health` = %f, \
        `Armor` = %f, \
        `Clothes` = %d, \
        `PosX` = %f, \
        `PosY` = %f, \
        `PosZ` = %f, \
        `PosR` = %f,",
        PlayerInfo[playerid][pRegistered],
        PlayerInfo[playerid][pRegstep],
        PlayerInfo[playerid][pGender],
        PlayerInfo[playerid][pDate][0],
        PlayerInfo[playerid][pDate][1],
        PlayerInfo[playerid][pDate][2],
        PlayerInfo[playerid][pAge],
        ScythReturnEscaped(PlayerInfo[playerid][pOrigin]),
        PlayerInfo[playerid][pDollars],
        PlayerInfo[playerid][pCents],
        PlayerInfo[playerid][pLevel],
        PlayerInfo[playerid][pHealth],
        PlayerInfo[playerid][pArmor],
        PlayerInfo[playerid][pClothes],
        PlayerInfo[playerid][pPosX],
        PlayerInfo[playerid][pPosY],
        PlayerInfo[playerid][pPosZ],
        PlayerInfo[playerid][pPosR]
    );
    
    format(query2, sizeof(query2), "`IP` = '%s', \
        `VirtualWorld` = %d, \
        `Interior` = %d, \
        `AdminLevel` = %d, \
        `Account` = %d, \
        `Balance1` = %d, \
        `Balance2` = %d, \
        `Job` = %d, \
        `Duty` = %d, \
        `Salary1` = %d, \
        `Salary2` = %d \
        WHERE `Username` = '%s'",
        PlayerInfo[playerid][pIP],
        PlayerInfo[playerid][pVW],
        PlayerInfo[playerid][pInt],
        PlayerInfo[playerid][pAdmin],
        PlayerInfo[playerid][pAccount],
        PlayerInfo[playerid][pBalance][0],
        PlayerInfo[playerid][pBalance][1],
        PlayerInfo[playerid][pJob],
        PlayerInfo[playerid][pDuty],
        PlayerInfo[playerid][pSalary][0],
        PlayerInfo[playerid][pSalary][1],
        Name
    );
    strcat(query, query2);
    mysql_query(query);
    print("called");
    printf(query);
    return 1;
}
Fixed it already, thanks btw.
Reply
#9

No problem bro
If you have some other problem hit me by PM, and if I can I'll help you
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)