Jump to content

dbExec warning


dromer

Recommended Posts

Posted

What could be the error?

Bad argument @ 'dbExec' [Expected db-connection at argument 1]

addEventHandler("onResourceStop", resourceRoot,
    function()
        for k,v in pairs(getElementsByType("vehicle")) do
            saveVehicle(id)
        end
    end
)

function saveVehicle(id)
    local vehicle = elements[id]
    if vehicle then
        local modelid = getElementModel(vehicle)    
        dbExec(connection, "UPDATE vehicle SET model=? WHERE id=?",modelid, id)
    end
end

 

Posted
9 hours ago, DNL291 said:

This error is very clear: 'connection' isn't returning a valid db-connection. Show us where 'connection' is defined.

The connection runs script start loaded datas

local connection = exports["connection"]:getConnection()

  • Moderators
Posted

The problem is in the connection resource. Maybe wrong database details, not exported function or something like that.

There must be another error message.

 

Hungarian

A probléma a connection resourcen belül lesz. Valószínűleg rossz adatbázis adatokat adtál meg, vagy a getConnection funkció nincs is exportálva. (vagy nem is fut a resource)

Lennie kell másik hibaüzenetnek is.

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