[SOLVED] Error when i try to link "es_roleplay" and "Job"


#1

I wanted to link es_roleplay and job (witch is stocking job info in db)
I did smting like dat but i got an error… can you help me ?

Code

AddEventHandler("es_roleplay:getPlayerJob", function(user, cb)
  local executed_query = MySQL:executeQuery("SELECT jobs.`job_name` FROM jobs LEFT JOIN users ON users.`job` = jobs.`job_id` WHERE users.`identifier` = `@id`", {['id'] = user})
  local result = MySQL:getResults(executed_query)
	if(cb ~= nil)then
		cb(tostring.result)
	end
end)

Error

2017-04-28 00:30:55.4385|ERROR|CitizenMP.Server|Error executing event handler for event es_roleplay:getPlayerJob in resource es_roleplay: Exception has been thrown by the target of an invocation.
2017-04-28 00:30:55.4404|ERROR|CitizenMP.Server| at [U] System.Reflection.MonoMethod.Invoke(Object obj,BindingFlags invokeAttr,Binder binder,Object[] parameters,CultureInfo culture)
2017-04-28 00:30:55.4404|ERROR|CitizenMP.Server| at [U] System.Reflection.MethodBase.Invoke(Object obj,Object[] parameters)
2017-04-28 00:30:55.4405|ERROR|CitizenMP.Server| at [U] System.Delegate.DynamicInvokeImpl(Object[] args)
2017-04-28 00:30:55.4405|ERROR|CitizenMP.Server| at [U] System.MulticastDelegate.DynamicInvokeImpl(Object[] args)
2017-04-28 00:30:55.4405|ERROR|CitizenMP.Server| at [U] System.Delegate.DynamicInvoke(Object[] args)
2017-04-28 00:30:55.4405|ERROR|CitizenMP.Server| at [U] CitizenMP.Server.Resources.ScriptEnvironment.TriggerEvent(String eventName,String argsSerialized,Int32 source)
2017-04-28 00:30:55.4405|ERROR|CitizenMP.Server|Inner exception: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':111000100965566 WHERE us.steam:111000100965566entifier = 'steam:111000100965566' at line 1
2017-04-28 00:30:55.4405|ERROR|CitizenMP.Server| at [U] MySql.Data.MySqlClient.MySqlStream.ReadPacket()
2017-04-28 00:30:55.4405|ERROR|CitizenMP.Server| at [U] MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow,Int64& insertedId)


#2

Can anyone help me please. I do not understand where my error is, when I make the request in sQL, everything is good but when I do it on FiveM, i got this error …


#3
	local executed_query = MySQL:executeQuery("SELECT identifier, job_id, job_name FROM users LEFT JOIN jobs ON jobs.job_id = users.job WHERE users.identifier = '@identifier'", {['@identifier'] = user})
	local result = MySQL:getResults(executed_query, {'job_name'}, "identifier")
	if(cb ~= nil)then
		cb(tostring(result[1].job_name))
	end