28.10.2017, 23:10
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);