Car toys not saving in MYSQL
#1

Код:
SaveVehicleCarToy(carid, toyidx, update) {
	if(update) {
		format(query, sizeof(query), "UPDATE `playercartoys` SET `X` = %f, `Y` = %f, `Z` = %f, `RX` = %f, `RY` = %f, `RZ` = %f WHERE `id` = %d",VehicleCarToys[carid][toyidx][EVehCarToy_X],VehicleCarToys[carid][toyidx][EVehCarToy_Y],VehicleCarToys[carid][toyidx][EVehCarToy_Z],VehicleCarToys[carid][toyidx][EVehCarToy_RX],VehicleCarToys[carid][toyidx][EVehCarToy_RY],VehicleCarToys[carid][toyidx][EVehCarToy_RZ],VehicleCarToys[carid][toyidx][EVehCarToy_SQLID]);
	} else {
		format(query, sizeof(query), "INSERT INTO `playercartoys` SET `X` = %f, `Y` = %f, `Z` = %f, `RX` = %f, `RY` = %f, `RZ` = %f, `carid` = %d, `toyidx` = %d",VehicleCarToys[carid][toyidx][EVehCarToy_X],VehicleCarToys[carid][toyidx][EVehCarToy_Y],VehicleCarToys[carid][toyidx][EVehCarToy_Z],VehicleCarToys[carid][toyidx][EVehCarToy_RX],VehicleCarToys[carid][toyidx][EVehCarToy_RY],VehicleCarToys[carid][toyidx][EVehCarToy_RZ],GetVehicleSQLID(carid),VehicleCarToys[carid][toyidx][EVehCarToy_ToyIdx]);
	}
	mysql_function_query(g_mysql_handle, query, true, "OnSaveCarToy", "ddd", carid, toyidx, update);
}
forward OnSaveCarToy(carid, toyidx, update);
public OnSaveCarToy(carid, toyidx, update) {
	new id = mysql_insert_id();
	if(!update) {
		VehicleCarToys[carid][toyidx][EVehCarToy_SQLID] = id;
	}
}
Its not saving in the mysql table..
Reply
#2

INSERT query is like:
Код:
INSERT INTO tbl_name (val1,val2) VALUES(232,15);
Source MySQL 5.7 Reference Manual: Insert
Reply
#3

MySQL supports SET syntax for inserts too. OP, show us your mysql log
Reply
#4

Quote:
Originally Posted by Misiur
Посмотреть сообщение
MySQL supports SET syntax for inserts too. OP, show us your mysql log
Код:
[03:16:00] Passing query SELECT `X`,`Y`,`Z`,`RX`,`RY`,`RZ`,`id`,`toyidx` FROM `playercartoys` WHERE `carid` = 12 | d
[03:16:00] ProcessQueryThread(OnLoadCarToys) - Query was successful. (SELECT `X`,`Y`,`Z`,`RX`,`RY`,`RZ`,`id`,`toyidx` FROM `playercartoys` WHERE `carid` = 12)
[03:16:00] ProcessQueryThread(OnLoadCarToys) - Data caching enabled.
[03:16:00] CMySQLHandler::StoreResult() - Result was stored.
[03:16:00] CMySQLHandler::FreeResult() - Result was successfully free'd.
[03:16:00] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[03:16:00] OnLoadCarToys(d) - Threaded function called.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)