Need Help with mysql saving vehicle
#1

[21:23:23] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''Owner'= Bingo ,'VehicleID'=587,'Parked'=1,'X'=169.427,'Y'=-135.869,'Z'=1.27' at line 1
Код:
SaveVehicles(playerid)
{
	new query[1000];
    mysql_format(mysql, query, sizeof(query), "UPDATE `Vehicles` SET 'Owner'= %s ,'VehicleID'=%d,'Parked'=%d,'X'=%f,'Y'=%f,'Z'=%f,'Angle'=%f,'Color_1'=%d,'Color_2'=%d,'Locked'=%d,'TotalVeh'=%d,'m1'=%d,'m2'=%d,'m3'=%d,'m4'=%d,'m5'=%d,'m6'=%d,'m7'=%d,'m8'=%d,'m9'=%d,'m10'=%d,'m11'=%d,'m12'=%d,'m13'=%d,'m14'=%d)",
	GetName(playerid),vInfo[playerid][VID],vInfo[playerid][Vparked],vInfo[playerid][VPx],vInfo[playerid][VPy],vInfo[playerid][VPz],vInfo[playerid][VPa],vInfo[playerid][VColor],vInfo[playerid][VColor2],vInfo[playerid][VLock],vInfo[playerid][VTot],
	vInfo[playerid][Vmod][0],vInfo[playerid][Vmod][1],vInfo[playerid][Vmod][2],vInfo[playerid][Vmod][3],vInfo[playerid][Vmod][4],vInfo[playerid][Vmod][5],vInfo[playerid][Vmod][6],vInfo[playerid][Vmod][7],vInfo[playerid][Vmod][8],
	vInfo[playerid][Vmod][9],vInfo[playerid][Vmod][10],vInfo[playerid][Vmod][11],vInfo[playerid][Vmod][12],vInfo[playerid][Vmod][13]);
	mysql_tquery(mysql, query, "", "");
	return 1;
}
Reply
#2

Use ' character only around %s or %e specifier. In the fields, it's ` character and it's not necessary.

pawn Код:
"UPDATE Vehicles SET Owner='%e',VehicleID=%d, ..."
Saving all the components even if a car does not have a single one, it's waste of 14 unused fields. Check Vince's tutorial: https://sampforum.blast.hk/showthread.php?tid=420363
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)