1. Post #201
    Gold Member
    AzuiSleet's Avatar
    September 2007
    758 Posts
    Yes.

  2. Post #202
    Gold Member
    DarkSpider's Avatar
    July 2006
    816 Posts
    I get system error 14001 when trying to require it.

  3. Post #203
    Gold Member
    AzuiSleet's Avatar
    September 2007
    758 Posts
    You may need the Microsoft Visual C++ 2008 Redist
    http://www.microsoft.com/downloads/d...displaylang=en

  4. Post #204
    Gold Member
    DarkSpider's Avatar
    July 2006
    816 Posts
    I already have it installed.

  5. Post #205
    Gold Member
    AzuiSleet's Avatar
    September 2007
    758 Posts
    Try this one:

  6. Post #206
    Gold Member
    DarkSpider's Avatar
    July 2006
    816 Posts
    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.

  7. Post #207
    Gold Member
    AzuiSleet's Avatar
    September 2007
    758 Posts
    Are you running it in singleplayer? The game is paused when you open the console in singeplayer, so it won't call Think hooks.

  8. Post #208
    Gold Member
    DarkSpider's Avatar
    July 2006
    816 Posts
    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.

  9. Post #209
    Gold Member
    AzuiSleet's Avatar
    September 2007
    758 Posts
    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.

  10. Post #210
    Gold Member
    DarkSpider's Avatar
    July 2006
    816 Posts
    Does 64bit matter or the mysql version?

  11. Post #211
    Gold Member
    AzuiSleet's Avatar
    September 2007
    758 Posts
    Resolved:
    Think hooks aren't called when there are no players in a dedicated server.

  12. Post #212
    jakejakke's Avatar
    August 2006
    206 Posts
    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

  13. Post #213
    messageboy's Avatar
    September 2008
    2 Posts
    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':

  14. Post #214
    jonney934's Avatar
    December 2007
    238 Posts
    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.

  15. Post #215
    Gold Member
    AzuiSleet's Avatar
    September 2007
    758 Posts

  16. Post #216
    Gold Member
    Killergam's Avatar
    August 2005
    1,984 Posts
    Bump, it disappeared from the list, and this is a important download.

  17. Post #217
    Mr.NaviPacho's Avatar
    December 2005
    29 Posts
    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.

  18. Post #218
    Gold Member
    Deco Da Man's Avatar
    July 2007
    1,017 Posts
    Works perfectly for me... make sure you are following the instructions exactly.

  19. Post #219
    Gold Member
    Catdaemon's Avatar
    February 2005
    2,821 Posts
    I use the tmysql module constantly and it works perfectly.

  20. Post #220
    Mr.NaviPacho's Avatar
    December 2005
    29 Posts
    I use the tmysql module constantly and it works perfectly.
    Do you think I could get a example of the code?

  21. Post #221
    Gold Member
    Catdaemon's Avatar
    February 2005
    2,821 Posts
    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))

  22. Post #222
    Mr.NaviPacho's Avatar
    December 2005
    29 Posts
    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...)

  23. Post #223
    Mr.NaviPacho's Avatar
    December 2005
    29 Posts
    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

  24. Post #224
    Pimpin' Member
    Stebbzor's Avatar
    September 2008
    631 Posts
    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

  25. Post #225
    Mr.NaviPacho's Avatar
    December 2005
    29 Posts
    Fixed the problem on my own, thanks anyway.

  26. Post #226
    Guardian9978's Avatar
    August 2006
    22 Posts
    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':

    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

  27. Post #227
    Gold Member
    Dennab
    April 2008
    1,500 Posts
    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?

  28. Post #228
    Mr.NaviPacho's Avatar
    December 2005
    29 Posts
    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...

  29. Post #229
    Gold Member
    Skapocalypse's Avatar
    November 2008
    769 Posts
    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.

  30. Post #230
    infinitywrai's Avatar
    December 2007
    539 Posts
    tmysql rocks, thanks azu

  31. Post #231
    Gold Member
    AzuiSleet's Avatar
    September 2007
    758 Posts
    You can't send DLLs to the client. (anymore)

  32. Post #232
    Gold Member
    Joerdgs's Avatar
    July 2005
    372 Posts
    Quick question: is keeping the database connection open constantly a good idea? Or just connect/disconnect every time you submit a query?

  33. Post #233
    Dennab
    March 2009
    1,572 Posts
    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).

  34. Post #234
    Mr.NaviPacho's Avatar
    December 2005
    29 Posts
    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.

  35. Post #235
    Dennab
    March 2009
    1,572 Posts
    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 .

  36. Post #236
    p3acemak3r's Avatar
    July 2009
    188 Posts
    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. :)

  37. Post #237
    p3acemak3r's Avatar
    July 2009
    188 Posts
    Does noone have an Answer?

  38. Post #238
    Gold Member
    LuaStoned's Avatar
    September 2007
    1,358 Posts
    If noone answers within 7 hours noone knows/has looked at the thread/cba to post it.

  39. Post #239
    p3acemak3r's Avatar
    July 2009
    188 Posts
    Yes. Sorry. But it very needed. Without, i cannot start my Work.

  40. Post #240
    WhiskeyFur's Avatar
    December 2007
    43 Posts
    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. :)
    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.