sql unorganized token
#1

hello i am trying to make a vehicle system with sql my add vehicle command shows me error when i use it

this is the error:
Код:
[Warning] db_query: Query failed: unrecognized token: "'1809.3"
this is my command:
Код:
CMD:aveh(playerid, params[])
{
    new model,color,color2,Float:cPos[4], price;
    if(sscanf(params, "iiii", model, price, color,color2)) return SendClientMessage(playerid, -1, "/aveh [model] [price] [color] [color]");
    if(model < 400 || model > 611) return SendClientMessage(playerid,-1, "vehicle IDs between 400 - 611!");
    if(color> 255 || color< 0) return SendClientMessage(playerid, 0xFFFFFF, "Car color ID's: 0-255");
    if(color2> 255 || color2< 0) return SendClientMessage(playerid, 0xFFFFFF, "Car color ID's: 0-255");
    GetPlayerPos(playerid, cPos[0], cPos[1], cPos[2]);
    GetPlayerFacingAngle(playerid, cPos[3]);
	LoadedVehicles ++;

	new Query[208];
	VehicleInfo[LoadedVehicles][vID]++;
//	format(Query, sizeof Query, "INSERT INTO vehicles (owner, ownerid, forsale, model, color1, color2, price, fuel, locked, health, posx, posy, posz, posa) VALUES ('%q', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%f', '%f', '%f', '%f', '%f')", "NONE", -1, price, 1, model, color, color2, 100, 0, 100.0, cPos[0], cPos[1], cPos[2], cPos[3]);
	format(Query, sizeof Query, "INSERT INTO vehicles (owner, ownerid, forsale, model, color1, color2, price, fuel, locked, health, posx, posy, posz, posa) VALUES ('%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%f', '%f', '%f', '%f', '%f')", "NONE", -1, price, 1, model, color, color2, 100, 0, 100.0, cPos[0], cPos[1], cPos[2], cPos[3]);
	db_query(VehicleDB, Query);
	VehicleInfo[LoadedVehicles][vSessionID] = CreateVehicle(model, cPos[0], cPos[1]-3, cPos[2], cPos[3], color, color2, -1);

    return 1;
}
Reply
#2

You don't need single quotes between %d, %f, so remove those.

Код:
%d, %f
Reply
#3

now it gives me this error
Код:
[Warning] db_query: Query failed: near "1848.758666": syntax error
nvm i fixed the problem the string was small
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)