Hey guys is this the correct way to call querys and setup the connection? Cause i'm getting no values from the database.
hook.Add("Initialize", "UniqueIdentifieradasad123", function()
require("mysqloo")
if (mysqloo) then
print("mysqloo is K")
else
print("mysqloo not K")
end
db = mysqloo.connect(MySQL.HOST, MySQL.USER, MySQL.PASSWORD, MySQL.DB, MySQL.PORT)
db.onConnected = function()
MsgC(Color(0, 255, 0), "He connects!!!\n")
end
db.onConnectionFailed = function()
MsgC(Color(255, 0, 0), "Failled connecting\n")
end
db:connect()
local Query0 = db:query([[CREATE TABLE IF NOT EXISTS `lebesttable` (
`id` varchar(20) NOT NULL,
`muney` INTEGER NOT NULL,
PRIMARY KEY(`id`)
);]])
Query0.onError = function(q,e) MsgC(Color(255, 0, 0), "beep bop error\n") end
Query0.start()
end)
I get no errors but I get no values either
Thanks in advance
You have to call it as `Query0:start()` or `Query0.start(Query0)`, currently you should be getting an error.
Also, you're not going to get any print outs from this once you fix the above, as you don't have an onSuccess callback.
Actually I had Query0:start() on my script but not in here. But yea seems to be working now, the problem was I missread the Docs and I was doing this
local data = Query0.onSuccess(q)
instead of:
Query0.onSuccess(q, data)
I was full potato mode last night...
Thanks for your time!
Sorry, you need to Log In to post a reply to this thread.