SA-MP Forums Archive
about sqlite - 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: about sqlite (/showthread.php?tid=660161)



about sqlite - 3417512908 - 26.10.2018

i am a sql noob so can you help me to find the problem?
Код:
stock SavePlayer(playerid)
{
    new Query[1000];
	format(Query, sizeof Query, "UPDATE users SET username = %s,Pass = %d,Skin = %d,W1 = %d,W2 = %d,Follower = %d,Cash = %d,Botnet = %d,Bag = %d,Drug = %d,FZ = %d,Wanted = %d,Jail = %d WHERE userid = %d",
	PlayerInfo[playerid][pName],
	PlayerInfo[playerid][pPass],
 	PlayerInfo[playerid][pSkin],
	PlayerInfo[playerid][pW1],
	PlayerInfo[playerid][pW2],
	PlayerInfo[playerid][pFollower],
	PlayerInfo[playerid][pCash],
	PlayerInfo[playerid][pBotnet],
	PlayerInfo[playerid][pBag],
	PlayerInfo[playerid][pDrug],
	PlayerInfo[playerid][pFZ],
	PlayerInfo[playerid][pWanted],
	PlayerInfo[playerid][pJail],
	PlayerInfo[playerid][pID]);
	db_query(Database, Query);
}
cannot save player


Re: sqlite problem - 3417512908 - 26.10.2018

anyone!!!emergency


Re: about sqlite - Calisthenics - 26.10.2018

Text values require apostrophes around the specifier. '%s' or escaped '%q'

Since you are new, always escape any input by players to avoid SQL injection and update values when they change. Update `username` column when a player changes their name or update `Pass` column when a player changes their password, there is really no reason to save them every time when they do not change.