Yes.
Yes.
I get system error 14001 when trying to require it.
You may need the Microsoft Visual C++ 2008 Redist
http://www.microsoft.com/downloads/d...displaylang=en
I already have it installed.
I may be dumb but it is not calling the callback passed.
require("tmysql") print("Hello") tmysql.initialize("127.0.0.1", "username", "password", "database", 3306, 6, 5) tmysql.query("SELECT 1+1", function(res,stat,id) print("DONE QUERY") end, 2)
Only outputs Hello.
Are you running it in singleplayer? The game is paused when you open the console in singeplayer, so it won't call Think hooks.
Running it on a dedicated server.
opening the file with
lua_openscript easy.lua
It did create the table but it never does any callbacks.
I'm running the easy.lua test, and it works fine. The only reason it shouldn't do the callbacks is if it paniced, which would mean the server died or it lost connection.
Does 64bit matter or the mysql version?
Resolved:
Think hooks aren't called when there are no players in a dedicated server.
Where are the gmsv_mysql.dll and gmcl_mysql.dll files located? I didn't find them from the zip folder.
Edit:
Whoops, I found them now. :P
Is there any fix for this error yet?
error loading module 'mysql' from file 'c:\garrymod\seven7\orangebox\garrysmod\lua\includ es\modules\gmsv_mysql.dll':
Could someone reupload the tmysql module? I have been searching for it forever and I found it here but to find the file was deleted, upload it to some place like solidfiles.
Here you go:
http://azuisleet.gayluadad.net/gmode/gm_tmysql2.zip
Bump, it disappeared from the list, and this is a important download.
Can someone please tell me if this is still working? I have tried gm_mysql and gm_tmysql and nether of them are working or me! With gm_mysql I was not getting any error but it still was not working at all. Please contact me here or on one of the many chat clients on my profile.
Works perfectly for me... make sure you are following the instructions exactly.
I use the tmysql module constantly and it works perfectly.
Do you think I could get a example of the code?
require("tmysql")
tmysql.initialize("server", "user", "pass", "db", port, 1, 1)
tmysql.query(Format("INSERT INTO PropSpawn (`SpawnEnt`,`Model`,`SteamID`) VALUES ('%s','%s','%s')",class,model,id))
Thanks! I got it working, I have no idea what I was doing incorrect but it works now so it's all god. (Changed too many things to tell what the problem was...)
I am still confused on how to use it correctly...
I am putting the query in a function and I am going to need to be able to return the results of the query by using "return" in the function, is this possible?
Example:
Code:function DB.CurrentMoney(ply) local result = tmysql.query("SELECT something FROM users WHERE steamid='"..ply:SteamID()."';") return result end
can anyone add me on steam my name is gotskilz4u im in lil trouble i am read blind and i need glasses i dont have so i am really bad at undestanding if anyone can explain simple way to make mysql and put my files were ill make them admin i know lua and i know how to install those files it just sum1 needs to explain to me do i need to download mysql from www.mysql.com or not ? do i have to buy sum serveR? or not
Fixed the problem on my own, thanks anyway.
Source Dedicated Server put libmySQL.dll in the same place as your srcds.exe
EX:
c:\srcds\orangebox\Garrysmod\
c:\srcds\orangebox\srcds.exe
c:\srcds\orangebox\libmySQL.dll
Listen Server put libmySQL.dll in the same place as your hl2.exe
EX:
C:\Program Files\Steam\steamapps\USERNAME\Garrysmod\Garrysmod \
C:\Program Files\Steam\steamapps\USERNAME\Garrysmod\hl2.exe
C:\Program Files\Steam\steamapps\USERNAME\Garrysmod\libmySQL. dll
Sorry for the bump, I have a problem, how are we supposed to put the .dll in the same fodler has hl2.exe when a bought server only allows access to the garrysmod\garrysmod folder?
You need to talk to the company you purchased the server from or find a new game server host.
Because as far as I know there is no way around it...
Superbump. I can't seem to get it working. I want people to load a list with mysql values, without having to download the dll's from here. I want it all done with my server sending it to them, but when I try adding it all to the server, and using Resource.AddFile, it still gives me this error
=[Code:attempt to index global 'mysql' (a nil value)
EDIT: Nevermind. I figured it out.
tmysql rocks, thanks azu
You can't send DLLs to the client. (anymore)
Quick question: is keeping the database connection open constantly a good idea? Or just connect/disconnect every time you submit a query?
Well, connection drops after a while, meaning you have to constantly check it and re-connect. I'm not really sure it's much of an advantage to do that, connecting uses almost no power. Just try not to even use MySQL much (like, I have load into table on join, save every 5 min, save on disconnect, done).
Seems like the connection only drops after a while if you are using a remote connection, because I had this problem until recently when I moved all my stuff to one server.
Strange, to be honest, it should drop itself after a while, but oh well .
local db, error = mysql.connect(ip,user,pass,data) if (db == 0 ) then print (tostring(error)) return end print ("Verbindung erstellt! ") local user = ply:Nick() local sid = ply:SteamID() local suche = mysql.query(db, "SELECT count(*) FROM names where steam = '"..ply:SteamID().."'") print(db) PrintTable(suche) print("\nsuche: "); print(suche[3]) print("\n\n"); print(suche) if (!suche) then return end schreib,enter, error = mysql.query(db, "INSERT INTO names (id,name,steam) VALUES ('','".. user .."','".. sid .."')") local succ2, error = mysql.disconnect(db) if (not succ2) then Msg( error .. "\n" ) end end
i Want, that the user can be entered in the database. But only when he is not already in it.
Please Help. :)
Does noone have an Answer?
If noone answers within 7 hours noone knows/has looked at the thread/cba to post it.
Yes. Sorry. But it very needed. Without, i cannot start my Work.
In mysql there is a "replace into" that you can use instead of a "insert into". What the mysql engine will do is see if the primary key you use in your values list already exists. If it does, then it's an update. else it's an insert operation.