Mysql Insert Problem (syntax error)
#1

Код:
				format(playercar[cars][car_owner],256,"%s",playerinfo[playerid][nickname]);
				playercar[cars][car_modelid] = carshopcarid;
				playercar[cars][car_spawnX] = 2268.287;
				playercar[cars][car_spawnY] = 48.163;
				playercar[cars][car_spawnZ] = 26.352;
				playercar[cars][car_spawnA] = 89.000;
				playercar[cars][car_color1] = carshopcarcolor;
				playercar[cars][car_color2] = carshopcarcolor;
				playercar[cars][car_tune] = 0;
				playercar[cars][car_locked] = 0;
				playercar[cars][car_id] = CreateVehicle(carshopcarid,2268.287,48.163,26.352,89.000,carshopcarcolor,carshopcarcolor,-1);
				GivePlayerMoney(playerid, -carshopcarprice);
				format(insertcar, sizeof(insertcar), "INSERT INTO `ucars` (owner, modelid, spawn_x, spawn_y, spawn_z, angle, color1, color2, health, tune, locked) VALUES ('%s', '%s', '2268.287', '48.163', '26.352', '89.000', '%s', '%s', '1000.0', '0', '0');",playerinfo[playerid][nickname], carshopcarid, carshopcarcolor, carshopcarcolor);
  			samp_mysql_query(insertcar);
It returns me an error into console:
Код:
Error in mysql_query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
I guess its because of some invalid string i try to add into mysql, i can't spot it so any 1 can help me?
Reply
#2

Use %d or %i, for integers.

playerinfo[playerid][nickname] -> string
carshopcarid -> integer
carshopcarcolor -> integer
carshopcarcolor -> integer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)