DatPsychopath Posted September 7, 2021 Share Posted September 7, 2021 Part of the script: if not data.update then local mQuery1 = mysql:query_insert_free("INSERT INTO vehicles_shop SET vehmtamodel='"..toSQL(data["mtaModel"]).."', vehbrand='"..toSQL(data["brand"]).."', vehmodel='"..toSQL(data["model"]).."', vehyear='"..toSQL(data["year"]).."', vehprice='"..toSQL(data["price"]).."', vehtax='"..toSQL(data["tax"]).."', createdby='"..toSQL(getElementData(client, "account:id")).."', notes='"..toSQL(data["note"]).."', enabled='"..toSQL(enabled).."', `spawnto`='"..toSQL(data["spawnto"]).."', `doortype` = " .. data.doortype) if not mQuery1 then outputDebugString("VEHICLE MANAGER / VEHICLE LIB / createVehicleRecord / DATABASE ERROR") outputChatBox("[VEHICLE MANAGER] Failed to create new vehicle #"..mQuery1.." in library.", client, 255,0,0) return false end Text displayed in the console: [18:10:55] INFO: MYSQL ERROR 1292: Incorrect datetime value: '0000-00-00 00:00:00' for column 'updatedate' at row 1 [18:10:55] INFO: VEHICLE MANAGER / VEHICLE LIB / createVehicleRecord / DATABASE ERROR [18:10:55] ERROR: vehicle-library\s_vehicle_library.lua:127: attempt to concatenate local 'mQuery1' (a boolean value) Does anyone know how to solve this problem? Whenever I try to create the vehicle, nothing happens and it shows this error. Link to comment
The_GTA Posted September 8, 2021 Share Posted September 8, 2021 Hello DatPsychopath, how was your MySQL database created? I am interested in the table creation commands. It might shed light on the cause of this issue. Link to comment
DatPsychopath Posted September 12, 2021 Author Share Posted September 12, 2021 I apologize for the late reply. The database was created so that a friend sent me an empty database structure, which he used on the server and worked for him. CREATE TABLE IF NOT EXISTS `vehicles_shop` ( `id` int(11) NOT NULL AUTO_INCREMENT, `vehmtamodel` int(11) DEFAULT '0', `vehbrand` text COLLATE utf8_czech_ci, `vehmodel` text COLLATE utf8_czech_ci, `vehyear` int(11) DEFAULT '2014', `vehprice` int(11) DEFAULT '0', `vehtax` int(11) DEFAULT '0', `createdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `createdby` int(11) NOT NULL DEFAULT '0', `updatedate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updatedby` int(11) NOT NULL DEFAULT '0', `notes` text COLLATE utf8_czech_ci, `handling` varchar(1000) COLLATE utf8_czech_ci DEFAULT NULL, `duration` int(11) NOT NULL DEFAULT '1000', `enabled` int(1) NOT NULL DEFAULT '0', `spawnto` tinyint(2) NOT NULL DEFAULT '0', `doortype` tinyint(4) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ; Link to comment
The_GTA Posted September 13, 2021 Share Posted September 13, 2021 (edited) @DatPsychopath Glad that you have responded! It looks like the issue does indeed stem from your MySQL table init query. Take a look at the following line: `updatedate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', The timestamp value of 0000-00-00 00:00:00 is outside of the range from '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC. Change the line to `updatedate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, because it does make sense that the SQL table entry was updated at the same time as it was created. If you have some weird code that checks if the database was never updated then you might have to adjust it too (I doubt it). I hope that you have no problem reinitializing that database. Maybe you might have to dump it beforehand if you already have data stored inside of it. Links for reference: * https://www.mysqltutorial.org/mysql-timestamp.aspx * https://dev.mysql.com/doc/refman/8.0/en/datetime.html Good luck with your scripting project! Edited September 13, 2021 by The_GTA 1 Link to comment
DatPsychopath Posted September 14, 2021 Author Share Posted September 14, 2021 I tried it and it works exactly as it should. Thank you so much for your help! 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now