PDA

View Full Version : Weird thing


devil shill
31/07/2014, 06:17 PM
Hey guys something weird here going on i these lines but they dont save in the database all the fields are there but it keeps 0 after executing the command where this line belongs to nothing in the mysql logs saying that it has updated that line so im wondering why it isnt updating it.

PlayerInfo[playerid][pPcarvw] = GetPlayerVirtualWorld(playerid);
PlayerInfo[playerid][pPcarint] = GetPlayerInterior(playerid);
format(string,sizeof(string),"UPDATE `samp_users` SET `carint`='%d', `carvw`='%d', WHERE `PlayerID`='%d'",PlayerInfo[playerid][pPcarint],PlayerInfo[playerid][pPcarvw],PlayerInfo[playerid][pDBID]);
mysql_query(string,THREAD_UPDATE,playerid);

Still though it fetches the fields onplayerconnect.

arko123
31/07/2014, 06:21 PM
Try removing the '' around the %d, they are only meant to be for strings for example

PlayerInfo[playerid][pPcarvw] = GetPlayerVirtualWorld(playerid);
PlayerInfo[playerid][pPcarint] = GetPlayerInterior(playerid);

format(string, sizeof string, "UPDATE samp_users SET carint = %d, carvw = %d WHERE PlayerID = %d",
PlayerInfo[playerid][pPcarint],
PlayerInfo[playerid][pPcarvw],
PlayerInfo[playerid][pDBID]
);

mysql_query(string, THREAD_UPDATE, playerid);


Also back slashes aren't really needed.

devil shill
31/07/2014, 06:28 PM
It worked Thanks Alot mate :)