Jump to content

Attempt to index 'mysql' (a nil value)


..:D&G:..

Recommended Posts

Hello, I am trying to make a gui to display the admin info, but I keep getting that error (from the title).

addEvent("showAdminStats",true) 
addEventHandler("showAdminStats",getRootElement(), 
    function( player ) 
            local result = mysql:query( "SELECT username, admin, lastlogin, adminreports FROM accounts WHERE admin != 0 AND admin < 10 ORDER BY admin DESC, username ASC" ) 
            if result then 
                local t = { } 
                while true do 
                    local row = mysql:fetch_assoc( result ) 
                    if row then 
                        table.insert(t, { row.username, tonumber(row.admin), row.adminreports, row.lastlogin }) 
                    else 
                        break 
                    end 
                end 
                mysql:free_result( result ) 
                setElementData(player,"adminStats",t) 
            end 
    end) 

The error is at line 4

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