Jump to content

[HELP] MySQL column a userdata value


..:D&G:..

Recommended Posts

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

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...