MySQL dont save user data
#1

Hello, I just added a new PlayerInfo variable. And now it mysql refuses to save the users data.

The mysql is:

pawn Код:
[ERROR] CMySQLQuery::Execute[OnQuerySend()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`, GUNID2`=0,`GUNID3`=0,`GUNID4`=0,`GUNID5`=0,`Ammo`=1,`Ammo2`=0,`Ammo3`=1,`Ammo' at line 1
This is the saveplayer code:

pawn Код:
public SavePlayer(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
    if(FirstSpawn[playerid] == 0 && Spawned[playerid] == 0) return 1;
    new Float: X, Float: Y, Float: Z, Int, Query[600], IP[20];
    GetPlayerIp(playerid, IP, 20);
    GetPlayerPos(playerid, X, Y, Z);
    Int = GetPlayerInterior(playerid);
    PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
    new QueryFinal[1500] = "UPDATE `playerdata` SET ";
    format(Query, sizeof(Query), "`username`='%s',`AdminLevel`=%d,`HelperLevel`=%d,`Level`=%d,`WaterBottle`=%d,`Faction`=%d,`Rank`=%d,`Leader`=%d,`Team`=%d,`FishingNet`=%d,`Boar`=%d,`Note`=%d,`Rope`=%d,`Fruit`=%d,`Boarmeat`=%d,`FishingRod`=%d,`Skin`=%d,`Sex`=%d,`Water`=%d,`Fish`=%d,`Heroin`=%d,`FireMatches`=%d,`Firewood`=%d,`Berry`=%d,`Whiskey`=%d,`Mask`=%d,`Clothes`=%d,`FishDone`=%d,`R-MUTED`=%d,`Muted`=%d,`aJailed`=%d,`Jailtime`=%d,`RespectPoints`=%d,`CoOwner`=%d,`Skill`=%d,",
    ReturnPlayerName(playerid),
    PlayerInfo[playerid][pAdmin],
    PlayerInfo[playerid][pHelper],
    PlayerInfo[playerid][pScore],
    PlayerInfo[playerid][pWaterBottle],
    PlayerInfo[playerid][pFaction],
    PlayerInfo[playerid][pRank],
    PlayerInfo[playerid][pLeader],
    PlayerInfo[playerid][pTeam],
    PlayerInfo[playerid][pFishingNet],
    PlayerInfo[playerid][pBoar],
    PlayerInfo[playerid][pNote],
    PlayerInfo[playerid][pRope],
    PlayerInfo[playerid][pFruit],
    PlayerInfo[playerid][pBoarMeat],
    PlayerInfo[playerid][pFishingRod],
    PlayerInfo[playerid][pSkin],
    PlayerInfo[playerid][pSex],
    PlayerInfo[playerid][pWater],
    PlayerInfo[playerid][pFish],
    PlayerInfo[playerid][pHeroin],
    PlayerInfo[playerid][pMatches],
    PlayerInfo[playerid][pWood],
    PlayerInfo[playerid][pBerry],
    PlayerInfo[playerid][pWhiskey],
    PlayerInfo[playerid][pMask],
    PlayerInfo[playerid][pClothes],
    PlayerInfo[playerid][pFishDone],
    PlayerInfo[playerid][pRmute],
    PlayerInfo[playerid][pMute],
    PlayerInfo[playerid][pJailed],
    PlayerInfo[playerid][pJailTime],
    PlayerInfo[playerid][pRespect],
    PlayerInfo[playerid][pCoOwner],
    PlayerInfo[playerid][pSkill]);
    strcat(QueryFinal, Query);
    format(Query, sizeof(Query), "`WalkieTalkie`=%d,`GUNID`=%d, `GUNMAT`=%d`, GUNID2`=%d,`GUNID3`=%d,`GUNID4`=%d,`GUNID5`=%d,`Ammo`=%d,`Ammo2`=%d,`Ammo3`=%d,`Ammo4`=%d,`Ammo5`=%d,`Pos_x`='%f',`Pos_y`='%f',`Pos_z`='%f',`Vip`=%d,`WalkieBroken`=%d,`ChoosenTeam`=%d,`RelationShip`=%d,`RelationWith`='%s',`Interior`=%d,`Warnings`=%d,`Slots`=%d,`SlotsFree`=%d,`BackPack`=%d,`Banned`=%d,`ip`='%s' WHERE `Username`='%s'",
    PlayerInfo[playerid][pWalkieTalkie],
    PlayerInfo[playerid][pGun],
    PlayerInfo[playerid][pGunM],
    PlayerInfo[playerid][pGun2],
    PlayerInfo[playerid][pGun3],
    PlayerInfo[playerid][pGun4],
    PlayerInfo[playerid][pGun5],
    PlayerInfo[playerid][pAmmo],
    PlayerInfo[playerid][pAmmo2],
    PlayerInfo[playerid][pAmmo3],
    PlayerInfo[playerid][pAmmo4],
    PlayerInfo[playerid][pAmmo5],
    X, Y, Z,
    PlayerInfo[playerid][pVip],
    PlayerInfo[playerid][pWalkieBroken],
    PlayerInfo[playerid][pChoosenTeam],
    PlayerInfo[playerid][pRelationShip],
    PlayerInfo[playerid][pRelationWith],
    Int,
    PlayerInfo[playerid][pWarn],
    PlayerInfo[playerid][pSlots],
    PlayerInfo[playerid][pSlotsFree],
    PlayerInfo[playerid][pBackPack],
    PlayerInfo[playerid][pBan],
    IP, ReturnPlayerName(playerid)); strcat(QueryFinal, Query);
    mysql_function_query(conn, QueryFinal, false, "OnQuerySend", "");

    return 1;
}
This is the part that the errors is coming from:

pawn Код:
strcat(QueryFinal, Query);
    format(Query, sizeof(Query), "`WalkieTalkie`=%d,`GUNID`=%d, `GUNMAT`=%d`, GUNID2`=%d,`GUNID3`=%d,`GUNID4`=%d,`GUNID5`=%d,`Ammo`=%d,`Ammo2`=%d,`Ammo3`=%d,`Ammo4`=%d,`Ammo5`=%d,`Pos_x`='%f',`Pos_y`='%f',`Pos_z`='%f',`Vip`=%d,`WalkieBroken`=%d,`ChoosenTeam`=%d,`RelationShip`=%d,`RelationWith`='%s',`Interior`=%d,`Warnings`=%d,`Slots`=%d,`SlotsFree`=%d,`BackPack`=%d,`Banned`=%d,`ip`='%s' WHERE `Username`='%s'",
    PlayerInfo[playerid][pWalkieTalkie],
    PlayerInfo[playerid][pGun],
    PlayerInfo[playerid][pGunM],
    PlayerInfo[playerid][pGun2],
    PlayerInfo[playerid][pGun3],
    PlayerInfo[playerid][pGun4],
    PlayerInfo[playerid][pGun5],
    PlayerInfo[playerid][pAmmo],
    PlayerInfo[playerid][pAmmo2],
    PlayerInfo[playerid][pAmmo3],
    PlayerInfo[playerid][pAmmo4],
    PlayerInfo[playerid][pAmmo5],
    X, Y, Z,
    PlayerInfo[playerid][pVip],
    PlayerInfo[playerid][pWalkieBroken],
    PlayerInfo[playerid][pChoosenTeam],
    PlayerInfo[playerid][pRelationShip],
    PlayerInfo[playerid][pRelationWith],
    Int,
    PlayerInfo[playerid][pWarn],
    PlayerInfo[playerid][pSlots],
    PlayerInfo[playerid][pSlotsFree],
    PlayerInfo[playerid][pBackPack],
    PlayerInfo[playerid][pBan],
    IP, ReturnPlayerName(playerid)); strcat(QueryFinal, Query);
    mysql_function_query(conn, QueryFinal, false, "OnQuerySend", "");
All this happend after I added GUNMAT

What could be wrong?
Reply
#2

=%d`, GUNID2`=%d,`GU

You're missing a ` before GUNID2.
Reply
#3

Will try that, thanks!

Will reply if it worked or not
Reply
#4

No, still dont work.

pawn Код:
format(Query, sizeof(Query), "`WalkieTalkie`=%d,`GUNID`=%d, `GUNMAT`=%d`,`GUNID2`=%d,`GUNID3`=%d,`GUNID4`=%d,`GUNID5`=%d,`Ammo`=%d,`Ammo2`=%d,`Ammo3`=%d,`Ammo4`=%d,`Ammo5`=%d,`Pos_x`='%f',`Pos_y`='%f',`Pos_z`='%f',`Vip`=%d,`WalkieBroken`=%d,`ChoosenTeam`=%d,`RelationShip`=%d,`RelationWith`='%s',`Interior`=%d,`Warnings`=%d,`Slots`=%d,`SlotsFree`=%d,`BackPack`=%d,`Banned`=%d,`ip`='%s' WHERE `Username`='%s'",
Код:
[ERROR] CMySQLQuery::Execute[OnQuerySend()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`, `GUNID2`=0,`GUNID3`=0,`GUNID4`=0,`GUNID5`=0,`Ammo`=0,`Ammo2`=0,`Ammo3`=0,`Amm' at line 1
Reply
#5

GUNMAT`=%d`, There's ` at the end of there too. Remove that and it should work.

GUNMAT`=%d,
Reply
#6

Yeah I changed it and now it works, thanks alot m8!

+rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)