about sqlite
#1

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
Reply
#2

anyone!!!emergency
Reply
#3

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)