[HELP] Mysql return nil

Hi everyone,

I try to get the rank from my police table but the rank is always “nil” when i print it.
Can someone tell me why and help me to fix it please? i tried so much alternative codes but it never work…
the police.rank is a string like “captain”.

Thanks.

Here is the code:

RegisterServerEvent('police:checkGrade')
AddEventHandler('police:checkGrade', function()
	TriggerEvent("es:getPlayerFromId", source, function(user)
	local identifier = user.getIdentifier()
	
	MySQL.Async.fetchAll("SELECT rank FROM police WHERE identifier =@identifier;", {['@identifier'] = identifier}, 
-- i tried SELECT * // WHERE identifier LIKE "@identifier" but it doesnt work neither
	function(result)
		if(result) then
			gradepo = result.rank
			print(gradepo) -- here it print NIL
			TriggerClientEvent("police:ReturnGrade", source, gradepo)
		end
		
		end)
	end)
end)

i found my mistake.

change the line

gradepo = result.rank

by this

gradepo = result[1].rank