I’m using tsmysql4. I can INSERT and it is successful, however the callback function doesn’t seem to run. This is the same for SELECT - I believe it runs, but can’t check the results as the callback function doesn’t seem to run.
Lobby.Database = SGN.SQLConnect( "127.0.0.1", "USERNAME", "PASSWORD", "SGN_Lobby", 3306 )
The below I put in console using lua_run and it INSERTS successfully.
Lobby.Database:Query( "INSERT INTO lobby_server ( game_id, address, active, enabled, participants_id ) VALUES ( 1, 'sleeplessnetwork.com', 1, 1, 1 )", function(result) PrintTable(result) end )
Here is the code I want to run:
function Lobby.Game.FindServer(id) Lobby.Database:Query( "SELECT * FROM lobby_server WHERE game_id = " .. id .. " AND active = 0 AND enabled = 1", function( result ) PrintTable( result ) end ) end
It does seem to run without an issue, but nothing outputs. I’ve tried print(“WORKED”) in the callback function but that doesn’t run either.
For reference, here is the tmysql4 documentation for queries:
Query from a database
Database:Query( String query, Function callback, Object anything, Boolean ColumnNumbers )
function callback( Table results )
Final note: I have tried running the above query in phpmyadmin ( replacing id with 1 ) and it returns a single row. I have also tried replacing the in-line function with a function name, and that still doesn’t work ( it doesn’t see to be running the function parameter )