Jump to content

MySQL help


StefanAlmighty

Recommended Posts

ERROR: MySQL\mysql_connect.lua:235: attempt to call global `MySQL_ping` (a nil value)

ERROR: doors\server_doors.lua:217: call: failed to call `MySQL:query` [string "?"]

^ the console just repeats these exact errors but for different resources, such as "gangs-system".

They worked fine on 1.4, but as soon as I converted to 1.5, I got these errors.

Link to comment
  • Moderators
ERROR: MySQL\mysql_connect.lua:235: attempt to call global `MySQL_ping` (a nil value)

I don't know how it could work on 1.4 because the function name is mysql_ping not MySQL_ping.

ERROR: doors\server_doors.lua:217: call: failed to call `MySQL:query` [string "?"]

I'm not really sure but it can be produced by the first error. Fix the first one and see if it's still there.

Link to comment

The resource automatically starts in my mtaserver.config and the function is exported because it works perfectly in 1.4 (I double checked in MySQL/meta.xml too). I only get these issues because of the transition between 1.4 and 1.5.

I just noticed another error in the console, so all three are:

  
ERROR: mysql\connection.lua:235: attempt t9 call global 'mysql_ping' (a nil value) 
  
ERROR: doors\server_doors.lua:217: call: failed to call `MySQL:query` [string "?"] 
  
ERROR: npcs\server_npcs.lua:14: attempt to call global 'mysql_null' (a nil value) 
  

Link to comment

That fixed it, thanks. Last thing, I'm getting a few issues where it says "access denied". I'm getting that from a few different resources.

For example, I have an in-game command called "setpw" which sets the servers password. I type it and nothing happens, but on the console it says:

WARNING: admin\admin_commands.lua:68: Access denied @ 'setServerPassword' 

Link to comment
  • Moderators

You have to add the resource into the Admin group in your acl.xml (he surely got replaced when you did your migration so that resource is not in that group anymore).

Only add resources you trust in that group and shutdown the server before manually editing acl.xml.

Link to comment

[After running my server it gives an error in the console which seems to effect a few things in-game.

WARNING: global\server_accounts.lua:24: getCharacterNameFromID(): Unable 

The function causing the issue:

  
function getCharacterNameFromID(charID) 
    if not charID then return false end 
    local query = exports.mysql:query_fetch_assoc("SELECT `charactername` FROM characters WHERE `id`='"..exports.mysql:escape_string(charID).."' LIMIT 1") 
    if query then 
        local charName = tostring(query["charactername"]) 
        exports.mysql:free_result(query) 
        if charName then 
            return charName 
        end 
    end 
    outputDebugString("getCharacterNameFromID(): Unable",2) 
    return false 
end 
  

It's exported in the mysql meta.xml so here's the code for the getCharacterNameFromID

  
function query_rows_assoc(str) 
    local queryresult = query(str) 
    if  not (queryresult == false) then 
        local result = rows_assoc(queryresult) 
        free_result(queryresult) 
        return result 
    end 
    return false 
end 
  

Link to comment
  • Moderators

Make sure that the table characters exists in your database and that there are datas in it.

Your script is probably calling at some point getCharacterNameFromID(x) where x is the id of the character in the table but if x is for example 4 and that there are only 1, 2 and 3 in the table, then it will throw the same error.

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