I want to learn how to read and write in my db… I can usually fix my own problem but there is no message, no error in console or anywhere… and nothing happen in the db, off course
I would like to find my sanity back… if you can help me spot the mistake. Thank you very much!
the table is called “users_cars”

In visual studio code
In raw lua
--<===============================================================================================================================>
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
--<===============================================================================================================================>
RegisterCommand("writedb", function(source args)
TriggerEvent('esx_burn:writedb')
end)
--<===============================================================================================================================>
RegisterServerEvent('esx_burn:writedb')
AddEventHandler('esx_burn:writedb', function(source) -- , Xplate, Xnitro, Xfuel)
------------------------------------------------------------------>
local _source = source
local xId = GetPlayerIdentifiers(_source)[1]
local xPlayer = ESX.GetPlayerFromId(_source)
local xPlate = "666 EVIL"
local xNitro = 69
local xFuel = 96
MySQL.Async.execute("INSERT INTO users_cars (id, owner, plate, nitro, fuel) VALUES (@id @owner, @plate, @nitro, @fuel)",
{
['@id'] = xId,
['@owner'] = xPlayer.identifier,
["@plate"] = xPlate,
["@nitro"] = xNitro,
["@fuel"] = xFuel
}, function (result)
TriggerClientEvent("output", _source, "^2 FAILED EVERYTIME ^0") -- debug
end)
------------------------------------------------------------------>
end)
--<===============================================================================================================================>
```MySQL.Async.execute("INSERT INTO users_cars (id, owner, plate, nitro, fuel) VALUES (@id @owner, @plate, @nitro, @fuel)",
{
['@id'] = xId,```
You have missed a coma where VALUES is, but I also want to ask, why are you using the ID as something you are writing to the DB?
Do you want it to have the same ID every time for that player?
Note, I haven’t checked the screenshots.
as of right now the value that i try to input are dummy data… i did not pay much attention to what i was trying to write but … why the hell it would not work 
I also see…
}, function (result)
there is no space between function and “(result)” … and the coma you spoted 
i though the id would auto add itself by the database… but that mean i should only try to input 4 values ?
VALUES (@id @owner, @plate, @nitro, @fuel)
to
VALUES (@owner, @plate, @nitro, @fuel) and the id will auto increment ?
EDIT: i can add that the id value is not important in my eyes… i want to save my nitro and fuel level inside the db… idealy in the owned_vehicles when im done experimenting
Yes, but also the owner column needs to have the identifier information. Not the ID column.
Basically, the owner information is just the server ID at the moment, not the SteamID.
i was trying to use it like this
[’@owner’] = xPlayer.identifier,
i’ll go dance around all that… see if something showup in the db
RegisterCommand can be run serverside ? i am triggering this debug codes with it
Read your locals.
It’s four am for me, and you’re way to quick to reply.
I’ll leave you with that my dude.
10-4 thank you very much… i appreciate the second opinion.
I am here now… and still nothing in the db… grr… if someone else can shed some light on my darkness
--<===============================================================================================================================>
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
--<===============================================================================================================================>
RegisterServerEvent('esx_burn:writedb')
AddEventHandler('esx_burn:writedb', function(source) -- , Xplate, Xnitro, Xfuel)
------------------------------------------------------------------>
local _source = source
local xOwner = GetPlayerIdentifiers(_source)[1]
local xPlate = "666 EVIL"
local xNitro = 69
local xFuel = 96
MySQL.Async.execute("INSERT INTO users_cars (owner, plate, nitro, fuel) VALUES (@owner, @plate, @nitro, @fuel)",
{
['@owner'] = xOwner,
["@plate"] = xPlate,
["@nitro"] = xNitro,
["@fuel"] = xFuel
}, function(result)
TriggerClientEvent("esx_burn:output", _source, "^2 TRYING TO OUTPUT ^0")
end)
------------------------------------------------------------------>
end)
--<===============================================================================================================================>
) " is outside the bracket.
dude, you brought me to the water and i still cant drink… now im looking at “)” everywhere and feel dumb and blind… i code a lot, and never tried any sql before… its lightly new to me
I think i need more sleep than you … i’ll find it!
At the end of the mysql execute string my dude. Try it within the bracket to enclose the sql statement. Xo
What do you get when you have two tired asf coders trying to solve a problem.
No hair, no sleep and even more problems.
lol
/SelfFacePalm
i’ll go try what you said… that would MAKE A LOOOOOOT OF SENSE… haha… jeez
Working… finally thank you dude!