Jump to content

[HELP] Failed to call 'mysql:query'[String"?"]


Recommended Posts

Hello, I'm currently working on a script that require some data from the SQL.

After figuring out how to set up and load the database that was required and connect it to an external database, I could finally start scripting.

Now here's the issue:

ERROR: call: failed to call 'mysql:query'[string"?"]

  
local factionID = tonumber(getElementData(theTeam, "id")) 
local vehicleID = exports.mysql:query("SELECT 'id' FROM 'vehicles' WHERE 'faction' = '".. factionID .."'") 
  

Link to comment

dont put quotes around tables, for they are not strings

also not around column names, for you don't want it to return the string 'id' either

like so

local factionID = tonumber(getElementData(theTeam, "id")) 
local vehicleID = exports.mysql:query("SELECT id FROM vehicles WHERE faction= '".. factionID .."'") 

not sure if this actually fixes it though, that error doesnt imply a syntax error. it should have succeeded at the call, but return nil. is this how exports work?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...