FredyH / MySQLOO

MySQLOO
GNU Lesser General Public License v2.1
138 stars 55 forks source link

Cant connect to database #133

Closed Zoom-Developer closed 5 months ago

Zoom-Developer commented 5 months ago

I used example code

require("mysqloo")
db = mysqloo.connect(HOST, USERNAME, PASSWORD, DB_NAME, PORT)

function db:onConnected()

    print( "Database has connected!" )

    local q = self:query( "SELECT 5+5" )
    function q:onSuccess( data )

        print( "Query successful!" )
        PrintTable( data )

    end

    function q:onError( err, sql )

        print( "Query errored!" )
        print( "Query:", sql )
        print( "Error:", err )

    end

    q:start()

end

function db:onConnectionFailed( err )

    print( "Connection to database failed!" )
    print( "Error:", err )

end

db:connect()

After that, nothing happened, the connection to the database was not carried out, there was not even an error OS: Windows 10

FredyH commented 5 months ago

You need to have a player (or bot) connected to the server for callbacks to be run.