sql error PRIMARY KEY must be unique
#1

Hello everyone i am trying to make a vehicle ownership system with sqlite i have done it so it save the first car but when ever i try to add more than one car it gives me this error :

Код:
[Warning] db_query: Query failed: PRIMARY KEY must be unique
Код:
	new DBResult: Result;

	Result = db_query(VehicleDB, "SELECT last_insert_rowid()"); // it will return the value for field "userid" generated
	VehicleInfo[LoadedVehicles][vID] = db_get_field_int(Result);
	db_free_result(Result);
	
	new Query[208];
	format(Query, sizeof Query, "INSERT INTO vehicles (id, owner, ownerid, price, forsale, model, posx, posy, posz, posa) VALUES (%d, '%s', '%d', '%d', '%d', '%d','%f', '%f', '%f', '%f')", VehicleInfo[LoadedVehicles][vID], "NONE", -1, price, 1, model, cPos[0], cPos[1], cPos[2], cPos[3]);
	db_query(VehicleDB, Query);
Reply


Messages In This Thread
sql error PRIMARY KEY must be unique - by lackmail - 28.10.2017, 23:10
Re: sql error PRIMARY KEY must be unique - by Jefff - 28.10.2017, 23:41
Re: sql error PRIMARY KEY must be unique - by lackmail - 28.10.2017, 23:47
Re: sql error PRIMARY KEY must be unique - by Jefff - 28.10.2017, 23:51
Re: sql error PRIMARY KEY must be unique - by lackmail - 29.10.2017, 00:04
Re: sql error PRIMARY KEY must be unique - by lackmail - 29.10.2017, 00:40

Forum Jump:


Users browsing this thread: 1 Guest(s)