I have got MySQL working with other scripts using all the same ways just different databases and things like that i have also done the following in my __resource file:
But i still continue to get the error here is the cause at line 42 but i cannot see the issue:
I’m off to bed, literally been at this for 11 hours - If you have any suggestions how to fix them please post and ill try in the morning. Thanks for replying already anyway! Your a champion.
New api using coroutine to have a sync feeling while still being async : local result = MySQL.[execute|fetchScalar|fetchAll|insert](query, params) which is possible due to the Citizen.Await function which allow to wait in an asynchronous way promises.
-- Not blocking the main thread, but block current execution context
print(MySQL.fetchScalar('SELECT NOW() as world'))
All async functions now returns a promise which can be chained by using the next method
[ERROR] [MySQL] An critical error happens on MySQL for query "SELECT name FROM inventory WHERE owner = "license:e7d37d444efb3b10fa535b0dbbc7d2bc80f9c0fe" {=}": Object reference not set to an instance of an object. at MySQLAsync.FetchScalar.Reader (MySql.Data.MySqlClient.MySqlCommand command) [0x00007] in <4566d747b17a449f9901d640a8efcabd>:0
at MySQLAsync.Operation`1[TResult].Execute (System.String query, System.Collections.Generic.IDictionary`2[TKey,TValue] parameters, System.Boolean debug) [0x0004c] in <4566d747b17a449f9901d640a8efcabd>:0
[ERROR] [MySQL] An critical error happens on MySQL for query "SELECT name FROM inventory WHERE owner = "license:e7d37d444efb3b10fa535b0dbbc7d2bc80f9c0fe" {=}": Object reference not set to an instance of an object. at MySQLAsync.FetchScalar.Reader (MySql.Data.MySqlClient.MySqlCommand command) [0x00007] in <4566d747b17a449f9901d640a8efcabd>:0
at MySQLAsync.Operation`1[TResult].Execute (System.String query, System.Collections.Generic.IDictionary`2[TKey,TValue] parameters, System.Boolean debug) [0x0004c] in <4566d747b17a449f9901d640a8efcabd>:0
nil
my request
MySQL.Sync.fetchScalar('SELECT name FROM inventory WHERE owner = "license:e7d37d444efb3b10fa535b0dbbc7d2bc80f9c0fe"',{}, function(rowsChanged)
print(rowsChanged)
end)
local countPlayer = MySQL.Sync.fetchScalar('SELECT name FROM inventory WHERE owner = "license:e7d37d444efb3b10fa535b0dbbc7d2bc80f9c0fe"')
to execute thread: ui_srv.lua:63: attempt to call a nil value (field 'fetchScalar')
stack traceback:
ui_srv.lua:63: in upvalue 'handler'
citizen:/scripting/lua/scheduler.lua:163: in function <citizen:/scripting/lua/scheduler.lua:162>
stack traceback:
[C]: in function 'error'
citizen:/scripting/lua/scheduler.lua:41: in field 'CreateThreadNow'
citizen:/scripting/lua/scheduler.lua:162: in function <citizen:/scripting/lua/scheduler.lua:131>
not work after update i’m change with Sync for fix temporarily