MySQL.Async.fetchAll - I need help

This is giving me some errors:

Citizen.CreateThread(function()

MySQL.Async.fetchAll(
    'SELECT * FROM items',
    {},
    function(result)

        for i=1, #result, 1 do
            ItemsLabels[result[i].name] = result[i].label
        end

    end
)

end)

It’s from a very old mysql, any clue how to rewrite it correctly?

Please post the errors you’re getting with this statement.

Screenshot_1 Screenshot_2 Screenshot_3

Your issue is on ge/server/main.lua line 45.

I know. But the problem is i do not know why, the picture in the middle is line 45.

Does it print anything for result before doing anything with it?

There is nothing wrong with the script. It referres to your database. As you can see it says mysql which is referring to your database. Maybe look there?

2 Likes

You might want to turn debug on in the mysql configuration so you see all of the statements being issued. Not a lot to go on here.

I’ll try, thanks.