MySQL and enum problem
#1

I have an issue with my MySQL reg/login system. First, there are values in the pInfo enum that are changing without being set. The pHouse slot, set to -1 on player connect, somehow changes to 48 between registration, log-in, and saving on disconnect, even if no other actions are performed. The values are not used anywhere else in the script currently and there is no default value set for the field in MySQL.

Also, the saving part of the system, using MySQL UPDATE, the order of some of the data gets jumbled, usually between 1 and 3 slots. There are no syntax errors in the queries, checked by mysql_debug();

Any help is appreciated. Thanks in advance.
Reply
#2

Try change your variable for 'pHouse' to a PVar integer, I had this problem a while ago where variables (specifically integers) would randomly shift values too, I'm not sure what could've caused it though.

As for the data "jumbling," any chance you could provide us with your update query?
Reply
#3

For the PVar, can that still be saved in MySQL without issues?

And the Update Query:
pawn Код:
format(Query, sizeof(Query), "UPDATE `pinfo` SET `Level`='%d', `Admin`='%d', `Reg`='%d', `Sex`='%d', `Age`='%d',`Origin`='%d', `Muted`='%d',`Frozen`='%d', `Cash`='%d', `Bank`='%d', `House`='%d', `Crimes`='%s', `Cuffed`='%d' WHERE `Name`='%s' AND `Key` = '%s';",
    PlayerInfo[playerid][pLevel],
    PlayerInfo[playerid][pAdmin],
    PlayerInfo[playerid][pReg],
    PlayerInfo[playerid][pSex],
    PlayerInfo[playerid][pAge],
    PlayerInfo[playerid][pOrigin],
    PlayerInfo[playerid][pMuted],
    PlayerInfo[playerid][pFrozen],
    PlayerInfo[playerid][pCash],
    PlayerInfo[playerid][pBank],
    PlayerInfo[playerid][pHouse],
    PlayerInfo[playerid][pCrimes],
    PlayerInfo[playerid][pCuffed],
    Name,
    PlayerInfo[playerid][pKey]);
This isn't the whole table, only certain parts that need to be saved currently. Could that affect it?
Reply
#4

Yeah, it will work fine, PVars are just different data types.

The only issue I see with your query is that you wrap single quotes around integers, try remove them from the integers in your query and see if it happens any more. I know it seems minor but the effects of it have been odd, as I used to do the same thing with MySQL/PAWN.
Reply
#5

I'll try that. I started to do that today, but then performed 2 queries of the same type in the SQL in phpMyAdmin, one with quotes and one without. There was no difference, but I'll try it in the GM and see if it happens.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)