SQL returning "table" or "null" + Definition of MySQL:getResults

Hi there.

I’m currently in the making of a quite large script which involves sql. I’m using the sql solution from Kane’s EssentialMode, however its not working as i’m expected.

To be clear yes, i know about the path in the mysql.lua, its set to the right path. And yes the dll is unblocked.

I’ve only just started and my first attempt was to deal with some whitelisting. The users is created in a user table, and im trying to access them like this:

-- Loading MySQL Class
require "resources/essentialmode/lib/MySQL" <- yes this is installed.

MySQL:open("127.0.0.1", "DBNAME <- ISSET", "USER <- ISSET", "PASS <- ISSET")

-- The identifier is set to the connecting users identifier this has been checked in a print.

local executed_query = MySQL:executeQuery("SELECT * FROM users WHERE identifier = '@name'", {['@name'] = identifier})

local result = MySQL:getResults(executed_query, {'identifier'}, "identifier")

-- now print(result) returns "table" AND print(result["identifier"]) returns null. however i expected atleast result["identifier"] to be the identifier returned. - Ive checked that my identifier and the identifier looked for in the db matches.

What am i doing wrong?

I’ve come to the conclusion that it might be possible that im misunderstanding the way getResults is used, and would like if some one could clearify why the its used like this “MySQL:getResults(executed_query, {‘identifier’}, “identifier”)” <- what is the {‘identifier’} used for and what is the ,“identifier” used for?

Thanks in advance

Btw. I tried searching for some help, couldent find any, if i’ve missed something on here, im sorry.

I can explain to you what getResults does.

function MySQL.getResults(self, mySqlCommand, fields, byField)

Currently byField is not being used, so the last ‘identifier’ does nothing, the table however specifies what fields you want it to return.

Perfect, thanks! - It all makes sense now.