[HELP] Society

I’m having a problem with esx_society, it’s not adding the job_grades, I’m doing it like this to test:

MySQL.ready(function()
	
	MySQL.Async.fetchAll('SELECT * FROM jobs where whitelisted = @id', 
	{
		['@id'] = 1
	}, function(result)
	
		for i=1, #result, 1 do
			Jobs[result[i].name] = result[i]
			Jobs[result[i].name].grades = {}
		end
	end)
	
	local result2 = MySQL.Sync.fetchAll('SELECT * FROM job_grades')
	
	for i=1, #result2, 1 do
		Jobs[tostring(result2[i].job_name)].grades[result2[i].grade] = result2[i]
	end
end)

RegisterCommand("test", function(source, args, raw)
	if source == 0 then		
		print(Jobs['unemployed'].grades[0].label)
	end
end, true)

when I use the test command, it gives me the following error:
[ script:esx_society] SCRIPT ERROR: @esx_society/server/main.lua:49: attempt to index a nil value (field ‘unemployed’)

when I restart the esx_society script it gives me the following error:
[ script:esx_society] SCRIPT ERROR: @esx_society/server/main.lua:33: attempt to index a nil value (field ‘?’)

hi, did you try to read what’s in your jobs table after the “for i=1, #result2, 1 do”

try this before your print it the RegisterCommand = print(json.encode(Jobs))

and you will see what’s in your jobs table