SA-MP Forums Archive
data base saving problem - 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: data base saving problem (/showthread.php?tid=665684)



data base saving problem - bosmania - 13.04.2019

So i have a skin system and i can't get the skins to save into the database,here's my saving function

SaveSkin(playerid)
{
new query[128];
mysql_format(SQL, query, sizeof(query), "UPDATE users SET `Skin` = '%d|%d|%d|%d|%d|%d|%d|%d|%d|%d' WHERE `name` = '%d'", PlayerInfo[playerid][pSkin][0], PlayerInfo[playerid][pSkin][1], PlayerInfo[playerid][pSkin][2], PlayerInfo[playerid][pSkin][3], PlayerInfo[playerid][pSkin][4],
PlayerInfo[playerid][pSkin][5], PlayerInfo[playerid][pSkin][6], PlayerInfo[playerid][pSkin][7], PlayerInfo[playerid][pSkin][8], PlayerInfo[playerid][pSkin][9], PlayerInfo[playerid][pNormalName]);
mysql_tquery(SQL, query, "", "");
}

and here's how im reading the skins from the data base

cache_get_field_content(0, "Skin", result); format(skin, 64, result);
sscanf(skin, "p<|>iiiiiiiiii", PlayerInfo[playerid][pSkin][0], PlayerInfo[playerid][pSkin][1], PlayerInfo[playerid][pSkin][2], PlayerInfo[playerid][pSkin][3], PlayerInfo[playerid][pSkin][4],
PlayerInfo[playerid][pSkin][5], PlayerInfo[playerid][pSkin][6], PlayerInfo[playerid][pSkin][7], PlayerInfo[playerid][pSkin][8], PlayerInfo[playerid][pSkin][9]);


and in the data base the format is like this at the `skin` column(as defined)

250|-1|-1|-1|-1|-1|-1|-1|-1|-1


and no,the problem is not with any other part of the code cause where im reading from the database the skins im also reading everything like name,pp,money etc,like absolutely everything and i don't have a problem with anything else


Re: data base saving problem - polygxn - 13.04.2019

pawn Code:
`name` = '%d'
Also, check your MySQL log file aswell.


Re: data base saving problem - SiaReyes - 13.04.2019

pawn Code:
`name` = '%s'
name should be a string but not a integer.