mysqloo problem

This is my code:

[lua]
require(“mysqloo”)

local DATABASE_HOST = “localhost”
local DATABASE_PORT = 3306
local DATABASE_NAME = “Players”
local DATABASE_USERNAME = “root”
local DATABASE_PASSWORD = “password”

DBTable = “Flood”

function connectToDatabase()
databaseObject = mysqloo.connect(DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT)
databaseObject.onConnected = function() print(“Database linked!”) end
databaseObject.onConnectionFailed = function() print(“Failed to connect to the database.”) end
databaseObject:connect()
end

connectToDatabase()
[/lua]

I have tried it in init.lua (The initial way I was doing it was in here). I’ve also tried doing in the autorun folder (server folder) and I always get this error:
17:26:10 L 02/12/2012 - 18:26:24: Lua Error: [gamemodes/Flood/gamemode/init.lua:20] attempt to index global ‘mysqloo’ (a nil value)

Basically I’m changing Flood from the original Flood tmysql to mysqloo (So it works on linux).

Failed suggestion.

Didn’t work, I’m pretty sure () work either way.

Yeah, it was mostly just a prod at something that seemed odd. I mean, this code should work if the person who posted the original tutorial had tested the code. I’ll look into it more, or someone else will see the problem before me.

[editline]12th February 2012[/editline]

Which line counts as line 20 in that snippet? The require statement or the mysqloo.connect part?

Thanks, I used this a while ago and it worked fine, this is my full code It’s pretty long so I put it on pastebin.

http://pastebin.com/pqHqCpFa

What’s killing me is that your syntax is fine according to mysqloo’s creator (http://www.facepunch.com/threads/933647-Gm_MySql-v1.0-OO-edition), it’s just that mysqloo is found to be a nil object, like it isn’t being defined when you require it.

[editline]12th February 2012[/editline]

Possibly helpful?
http://www.facepunch.com/threads/994126

I had a look at that but his problem was that he had it inside the spawn function I believe

One last try: are you running this on a Linux machine? If you are, did you make sure to try what I think was Chrisaster’s previous fix of renaming the original .dll to gmsv_mysqloo_linux.dll? http://www.facepunch.com/threads/933647?p=32571520&viewfull=1#post32571520

I’m using the linux binarys that were released, do they need to be renamed?

What’s their names now?

gmcl_mysqloo_i486.dll
gmsv_mysqloo_i486.dll

Uh. Try without the _486?
gmsv_mysqloo.dll ?

19:53:59 L 02/12/2012 - 20:54:13: Lua Error: [gamemodes/Flood/gamemode/init.lua:20] attempt to index global ‘mysqloo’ (a nil value)
19:53:59 L 02/12/2012 - 20:54:13: Load Gamemode: ‘Flood’
19:53:59 L 02/12/2012 - 20:54:13: Lua Error: [cpp]

Stupid question, but: You sure they’re the right place? The .dll files?

I’m pretty sure, if I rename it to something random it errors. They are in /orangebox/garrysmod/lua/includes/modules

Remove “i486” and use “linux”. I think that’s what the fix implies.

error loading module ‘mysqloo’ from file ‘/home/gmod/srcds/orangebox/garrysmod/lua/includes/modules/gmsv_mysqloo_linux.dll’:
libmysql.so.16: cannot open shared object file: No such file or directory
WireMod Installed. Version: 2521

Tried redownloading them?

Yep

I am having the same problem with Linux MYSQLOO…

[editline]13th February 2012[/editline]

error loading module ‘mysqloo’ from file ‘/home/gmod/navalwarfare/orangebox/garrysmod/lua/includes/modules/gmsv_mysqloo_linux.dll’:
libmysql.so.16: cannot open shared object file: No such file or directory

Try gmsv_mysqloo_linux…