SA-MP Forums Archive
Mysql don't Save - 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: Mysql don't Save (/showthread.php?tid=368915)



Mysql don't Save - pepy - 15.08.2012

Hi guys, I create a Command to save my variables: " pvModel", but this variables didn't save in my db.
This is a Code
Код:
CMD:prova1(playerid,params[])
{
 	new string[256];
 	format(string, sizeof(string), "UPDATE playervehicles SET pvModel = '%d'", carVariables[playerid][pvModel]);
 	mysql_query(string);
	return 1;
}
In my db there is:
playervehicles => pvModel


Re: Mysql don't Save - Abreezy - 15.08.2012

You need to add the second part..

pawn Код:
"WHERE Vehicleid? =%d",GetPlayerVehicleId(playerid));"
Something like that.

Here's a small guideline..

pawn Код:
format(save, sizeof(save), "UPDATE Tablename SET whateveryouwant to save = %d  WHERE Top field that gets the whole thing, such as vehicleid = %d",

        whateverthethingisfor %d,
        GetPlayerVehicleID(playerid) or w/e you use here.);