..:D&G:.. Posted February 20, 2016 Share Posted February 20, 2016 Hello guys, I am trying to get the value of a column from a mysql database, but instead of getting a number it gets a userdata and when I try "type(row.neon)" it gets a resource data... function attachNeonsToVehicles() for i, v in ipairs(getElementsByType("vehicle")) do local dbid = getElementData(v, "dbid") local row = exports.mysql:query_fetch_assoc("SELECT * FROM vehicles WHERE id = " .. exports.mysql:escape_string(dbid) ) if row then if (row.neon > 0) then setElementData(v, "neon", row.neon) attachNeon(v, row.neon) else setElementData(v, "neon", 0) end end end end addEventHandler ( "onResourceStart", getRootElement(), attachNeonsToVehicles ) Any ideas? Link to comment
..:D&G:.. Posted February 20, 2016 Author Share Posted February 20, 2016 Attempt to index 'neon' (a userdata value) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now