1. Post #441
    Query:GetData isnt working. Test code:

    	local steamID = ply:GetNWString("SteamID")
    	local load = MySql:query("SELECT * FROM player_info WHERE unique_id = '"..steamID.."'")
    	load:start()
    	local wallet = load:getData()
    	print(table.ToString(wallet, "shit", false))
    
    no matter what way i use it it always returns an empty table, and yes, the row exists. I checked manually.
    You're not defining a callback function anywhere which is why it's returning as an empty table.

    	local load = MySql:query("SELECT * FROM player_info WHERE unique_id = '"..steamID.."'")
    	load.onSuccess = function(self) 
    		local wallet = self:getData()
    		print(table.ToString(wallet, "shit", false))
    	end
    	load:start()
    

    Edited:

    if you copy pasted this straight in, there was a space between function and (self). You may want to remove that.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Lua King Lua King x 1 (list)

  2. Post #442
    facecardz's Avatar
    February 2011
    145 Posts
    You're not defining a callback function anywhere which is why it's returning as an empty table.

    	local load = MySql:query("SELECT * FROM player_info WHERE unique_id = '"..steamID.."'")
    	load.onSuccess = function(self) 
    		local wallet = self:getData()
    		print(table.ToString(wallet, "shit", false))
    	end
    	load:start()
    

    Edited:

    if you copy pasted this straight in, there was a space between function and (self). You may want to remove that.
    No, i retype any bit of code i'm copying--helps with the learning process.

    So anything that involves data from the query object has to be in a function wrapper?

    See also: You're my new best friend </nohomo>
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  3. Post #443
    No, i retype any bit of code i'm copying--helps with the learning process.

    So anything that involves data from the query object has to be in a function wrapper?

    See also: You're my new best friend </nohomo>
    Correct. A list of the callback functions (for each situation) is available on page 1.

    You can also do something like this

    local function MyCallback(self)
    	local wallet = self:getData()
    	//etc etc here
    end
    
    
    //Lets say a function is here and is in its own scope etc
    local load = MySql:query("SELECT * FROM player_info WHERE unique_id = '"..steamID.."'")
    load.onSuccess = MyCallback
    load:start()
    
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Friendly Friendly x 1 (list)

  4. Post #444
    facecardz's Avatar
    February 2011
    145 Posts
    You can also do something like this

    -snip- for length
    Is that any more efficient? Or is it simple for the sake of code organization?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  5. Post #445
    Is that any more efficient? Or is it simple for the sake of code organization?
    It's purely optional. I do it for the sake of keeping my code as clean as possible but it boils down to whatever works for you.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  6. Post #446
    agmike's Avatar
    September 2010
    120 Posts
    there's a way to make the lua wait for the response so you can :GetData immediately after a start but if your SQL server can't respond fast enough (which becomes a problem only really if you ever run multiple servers around the world) then the entire server hangs until the lua finishes, which is why threading is generally preferred.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  7. Post #447
    Wolfman992's Avatar
    June 2010
    12 Posts
    -snip-

    Stupid error I made, nevermind
    Reply With Quote Edit / Delete Windows 7 Canada Show Events

  8. Post #448
    Gold Member
    .\\Shadow}'s Avatar
    November 2009
    886 Posts
    -snip-

    I was missing the VC++ 2008 Redist.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  9. Post #449
    agmike's Avatar
    September 2010
    120 Posts
    any special reason why a magic space came before modules? on windows that would create a different path and fail.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  10. Post #450
    ezio audtioriet
    alexanderk's Avatar
    May 2007
    1,338 Posts
    any special reason why a magic space came before modules? on windows that would create a different path and fail.
    It's the forum that does that
    Reply With Quote Edit / Delete Windows 7 Norway Show Events

  11. Post #451
    Gold Member
    .\\Shadow}'s Avatar
    November 2009
    886 Posts
    -snip-
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  12. Post #452
    Gold Member
    Gfoose's Avatar
    July 2011
    629 Posts
    Query:GetData isnt working. Test code:

    	local steamID = ply:GetNWString("SteamID")
    	local load = MySql:query("SELECT * FROM player_info WHERE unique_id = '"..steamID.."'")
    	load:start()
    	local wallet = load:getData()
    	print(table.ToString(wallet, "shit", false))
    
    no matter what way i use it it always returns an empty table, and yes, the row exists. I checked manually.
    Any specific reason that you're using networked variables to get a players steamid? You should use ply:SteamID() instead.
    Reply With Quote Edit / Delete Windows 7 Australia Show Events Agree Agree x 1 (list)

  13. Post #453

    August 2011
    1 Posts
    -snip-
    I'm too dumb. Didn't notice query:wait() method to delay the script execution
    Reply With Quote Edit / Delete Windows 7 Russian Federation Show Events

  14. Post #454
    facecardz's Avatar
    February 2011
    145 Posts
    Any specific reason that you're using networked variables to get a players steamid? You should use ply:SteamID() instead.
    No, and i actually noticed that a while ago. I was adapting this from a script I made a while ago.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  15. Post #455
    Gold Member
    Gfoose's Avatar
    July 2011
    629 Posts
    No, and i actually noticed that a while ago. I was adapting this from a script I made a while ago.
    Try to stay as far away from networked variables as possible, use usermessages, runconsolecommand(concommands)
    Reply With Quote Edit / Delete Windows 7 Australia Show Events

  16. Post #456
    hydral1k's Avatar
    June 2011
    71 Posts
    Fixed the broken formatting of functions and listings on the front page...

    Usage
    [HR][/HR]
    Basic functionality:
    - mysqloo.connect - Create a new database connection
    - Parameters: (hostname, username, password, database, port, unix socket, client flag)
    - Returns: Database object


    Database object:
    ~ Database:connect - Start connecting to the database
    - Parameters: ()
    - Returns: Nothing

    ~ Database:escape - Make text safe for queries
    - Parameters: (text)
    - Returns: Escaped string

    ~ Database:abortAllQueries - Aborts all running queries
    - Parameters: ()
    - Returns: Nothing

    ~Database:status - Check database status
    - Parameters: ()
    -Returns: One of:
    >>> mysqloo.DATABASE_CONNECTED - (0) - Connected to the database.
    >>> mysqloo.DATABASE_CONNECTING - (1) - Current is attempting to connect
    >>> mysqloo.DATABASE_NOT_CONNECTED - (2) - Connection was not successful or has failed
    >>> mysqloo.DATABASE_INTERNAL_ERROR - (3) - Some internal error occured

    ~ Database:query - Query the database
    - Parameters: (query)
    - Returns: Query object

    ~ Database:onConnected - Callback when connected successfully
    - Parameters: ()
    - Returns: Nothing

    ~ Database:onConnectionFailed - Callback when connection could not be established.
    - Parameters: (error_message)
    - Returns: Nothing

    ~ Database:wait() - blocks until connection has been completed.

    Query object:
    ~ Query:start - Start a query running
    - Parameters: ()
    - Returns: Nothing

    ~ Query:abort - Abort a query running
    - Parameters: ()
    - Returns: Nothing

    ~ Query:getData - Get all data from a query
    - Parameters: ()
    - Returns: Table containing all the data that has been read so far

    ~ Query:setOption - Change query options
    - Parameters: (Flag, set)
    - Flag is one of:
    >>> mysqloo.OPTION_NUMERIC_FIELDS - (1) - Use numeric fields when presenting data [default:off]
    >>> mysqloo.OPTION_NAMED_FIELDS - (2) - Use named fields when presenting data [default:on]
    >>> mysqloo.OPTION_INTERPRET_DATA - (4) - Auto-convert int/float fields to int/float representation [default:on]
    >>> mysqloo.OPTION_CACHE - (8) - Cache the data after reading it [default:on]
    - Returns: Nothing

    ~ Query:status - Check query status
    - Parameters: ()
    - Returns: One of:
    >>> mysqloo.QUERY_NOT_RUNNING - (0) - Query has not been started yet.
    >>> mysqloo.QUERY_RUNNING - (1) - The query is executing on the database.
    >>> mysqloo.QUERY_READING_DATA - (2) - The query has been run, and is now reading the data back.
    >>> mysqloo.QUERY_COMPLETE - (3) - The query has completed (successfully or with an error).
    >>> mysqloo.QUERY_ABORTED - (4) - The query has been aborted.

    ~ Query:onData - Callback when a single row has been received
    - Parameters: (data_row)
    - Returns: Nothing

    ~ Query:onSuccess - Callback when all data has been received
    - Parameters: ()
    - Returns: Nothing

    ~ Query:onFailure - Callback when an error occured
    - Parameters: (error_message)
    - Returns: Nothing

    ~ Query:onAborted - Callback when a query was aborted
    - Parameters: ()
    - Returns: Nothing

    ~ Query:wait() - blocks until query has been completed (and all data read back).
    Reply With Quote Edit / Delete Windows 7 United States Show Events Friendly Friendly x 2Informative Informative x 1 (list)

  17. Post #457
    Hi Jo
    Jo The Shmo's Avatar
    February 2009
    22,848 Posts
    So I get the same error as this guy:
    http://www.facepunch.com/threads/910...em-error-14001
    For the mysqloo module.

    I'm just renting a server from sourcehoster, so I don't have control over the server, is there anything anyone can do to make it work?
    Like recompiling the module?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  18. Post #458
    Make sure the server your hoster is using has the redistribution packages for C++ etc installed.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  19. Post #459
    MRDRMUFN's Avatar
    March 2011
    18 Posts
    Im sorry, I'm new to lua and am working on modifying the mysql version of ULX Utime [UtimeM] to use the mysqloo module. And im getting an error that i can't seem to figure out.
    [edit]: solved previous issue, and found a bigger one

    Code:
    [lua\autorun\server\sv_utime.lua:31] attemt to index local 'query' (a nil value)
    Is it just me or is scoping seriously messed up?

    Code:
    -- Written by Team Ulysses, http://ulyssesmod.net/
    -- Modified by ACProdigy for MySQL operation
    -- Modified by MRDRMUFN for gm_mysqloo support
    -- module( "Utime", package.seeall )
    if not SERVER then return end
    require( "mysqloo" )
    print(mysqloo.VERSION)
    
    ----- Database connection details -----
    
    local DATABASE_HOST = "127.0.0.1"
    local DATABASE_USERNAME = "******"
    local DATABASE_PASSWORD = "******"
    local DATABASE_PORT = 3306
    local DATABASE_NAME = "test"
    
    --=== DO NOT EDIT BELOW THIS POINT ====
    
    local server = mysqloo.connect(DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT)
    
    function connectSQL(server)
    server.onConnected = checkTable(server)
    server.onConnectionFailed = function(D, E) print( "[Utime] Failed to Connect to Database: " .. E ) end
    server:connect()
    end
    
    ----- Check for Table Existence -------
    function checkTable(server)
    	print("[Utime] Connected")
    	local query = server:query("SHOW TABLES LIKE 'utime';")
    	query.onError = function() print("[Utime] Failed to read Table!") end
    	query:start()
    end
    
    connectSQL(server)
    Seriously WTF?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  20. Post #460
    function checkTable(server)
    	print("[Utime] Connected")
    	local query = server:query("SHOW TABLES LIKE 'utime';")
    	query.onError = function() print("[Utime] Failed to read Table!") end
    	query:start()
    end
    

    So you're attempting to call itself in the same scope?

    Use something like Query or TableQuery instead.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  21. Post #461
    MRDRMUFN's Avatar
    March 2011
    18 Posts
    Well i have tried other variable names instead of query it just does the same thing.
    function checkTable(server)
        print("[Utime] Connected")
        local Qu = server:query("SHOW TABLES LIKE 'utime';")
        Qu.onError = function() print("[Utime] Failed to read Table!") end
        Qu:start()
    end
    

    So you're attempting to call itself in the same scope?

    Use something like Query or TableQuery instead.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  22. Post #462
    Facepunch's #1 Huskybutt
    James xX's Avatar
    July 2011
    2,090 Posts
    Well i have tried other variable names instead of query it just does the same thing.
    
    function connectSQL(server)
    server.onConnected = checkTable(server)
    server.onConnectionFailed = function(D, E) print( "[Utime] Failed to Connect to Database: " .. E ) end
    server:connect()
    end
    
    ----- Check for Table Existence -------
    function checkTable(server)
    	print("[Utime] Connected")
    	local query = server:query("SHOW TABLES LIKE 'utime';")
    	query.onError = function() print("[Utime] Failed to read Table!") end
    	query:start()
    end
    

    Where you define server.onConnected, your calling the function. What you need to do is this:

    server.OnConnected = function( ) checktable( server ) end
    
    Reply With Quote Edit / Delete Windows XP France Show Events

  23. Post #463
    MRDRMUFN's Avatar
    March 2011
    18 Posts
    Ok i've managed to get everything to work except loading the time saved on the table. the time is saved properly when they leave, it just doesnt load it when they spawn. so it starts back at zero.
    function onJoin( ply )
    	
    	local uid = ply:UniqueID()
    	local sid = ply:SteamID()
    	local nam = ply:Nick()
    	local tem = team.GetName( ply:Team() )
    	local time = 0
    	
    	function updateLastVisit()
    		print("[UTime] Updating Last Visit")
    		local Qc = server:query("UPDATE utime SET lastvisit = " .. os.time() .. " WHERE player = " .. uid .. ";")
    		Qc.onFailure = function(Err) print(Err) end
    		Qc:start()
    	end
    	
    	function addPly()
    		print("[UTime] Adding Player entry")
    		local Qc = server:query("INSERT into utime ( player, totaltime, lastvisit, steamid, playername, team ) VALUES ( " .. uid .. ", 0, " .. os.time() .. ", '" .. sid .. "', '" .. server:escape(team.GetName( ply:Team())) .. "', '" .. server:escape(tem) .. "' );")
    		Qc.onFailure = function(Err) print(Err) end
    		Qc:start()
    	end
    	
    	function checkRow()
    		print("[UTime] checking for player")
    		local Qc = server:query("SELECT * FROM utime WHERE player = " .. uid .. ";")
    		Qc.onSuccess = function(this)
    			num_rows = 0
    			local row = this:getData()
    			if not (row == nil) then
    				for k, v in pairs(row) do 
    					num_rows = num_rows + 1
    				end
    			end
    			if (num_rows == 1) then
    				print("[Utime] Player exists")
    				ULib.tsay( ply, "[Utime] Welcome back " .. ply:Nick() .. ", you last played on this server " .. os.date( "%c", row[1][4] ) )
    				time = row[1][3]
    				updateLastVisit()
    			else
    				print("[Utime] Player does not exist")
    				print("[Utime] New Player Added: " .. ply:Nick())
    				ULib.tsay( ply, "[UTime] Welcome to our server " .. ply:Nick() .. "!" )
    				addPly()
    			end
    			ply:SetUTime( time )
    			ply:SetUTimeStart( CurTime() )
    		end	
    		Qc.onFailure = function(Err) print(Err) end
    		Qc:start()
    	end
    	checkRow()
    end	
    hook.Add( "PlayerInitialSpawn", "UTimeInitialSpawn", onJoin )
    -------------------------------------
    
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  24. Post #464
    Gold Member
    Fleamonji's Avatar
    April 2010
    627 Posts
    why are you defining the function each time and then running it right below? why not just run the code inside the function..
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  25. Post #465
    MRDRMUFN's Avatar
    March 2011
    18 Posts
    oh it was just personal preference, i dont think it would make a difference though
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  26. Post #466
    Gold Member
    Fleamonji's Avatar
    April 2010
    627 Posts
    oh it was just personal preference, i dont think it would make a difference though
    it's just inefficient
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  27. Post #467
    MRDRMUFN's Avatar
    March 2011
    18 Posts
    well either way it doesn't really help me solve my issue
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  28. Post #468
    Gold Member
    Fleamonji's Avatar
    April 2010
    627 Posts
    try ply:SetUTime( tonumber( time ) )
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  29. Post #469
    MRDRMUFN's Avatar
    March 2011
    18 Posts
    nope that doesn't work, i think its a timing issue, like the client is trying to access the time before the query sets it. since the time gets set outside the main thread.

    [edit]: i've tried print( row[1][3] ) right after assigning it to time and its null.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  30. Post #470
    MRDRMUFN's Avatar
    March 2011
    18 Posts
    here is a link to a copy of the edited addon if anyone wants to take a look at it. http://dl.dropbox.com/u/34509350/UTimeM.zip
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  31. Post #471
    Gold Member
    Donkie's Avatar
    July 2009
    1,252 Posts
    Because of boredom, I fixed up the OP.








    Crashing/Problems?
    Please give me as much information as possible:
    * Test scripts / Example code
    * MDMP files

    * Make sure you're running the most up-to-date version


    Changes

    v7
    * Added calls to mysql_library_init/mysql_library_end
    * (Hopefully) fixed crash that could occur randomly
    * Updated to version 6.0.2 of libmysql
    * Fixed problem with on Linux that would stop queries from running

    v6
    * Fixed a potential problem with the Linux DLLs
    * Fixed a problem with the Garbage Collection (thanks haza55)

    v5.1
    * Linux binaries now available

    v5
    * Finally tracked down the crash (it was due to libmysql.dll, so downgraded to 5.0). Thanks to everyone who helped.
    * Added version code (mysqloo.VERSION, mysqloo.MYSQL_VERSION, mysqloo.MYSQL_INFO)
    * Added server version (Database:serverVersion, Database:serverInfo, Database:hostInfo)

    v4
    * Attempt to fix the crash problems that people are having...

    v3
    * Added function: Database:wait() - blocks until connection has been completed.
    * Added function: Query:wait() - blocks until query has been completed (and all data read back).

    v2
    * Bug fix - objects would be garbage collected whilst still running threads. This would show up more often if you were attempting to connect to a server that did not exist.

    v1
    * Initial release

    Example
    require("mysqloo")
    
    local DATABASE_HOST = "localhost"
    local DATABASE_PORT = 3308
    local DATABASE_NAME = "test"
    local DATABASE_USERNAME = "root"
    local DATABASE_PASSWORD = "1234"
    
    function printQuery(query)
      PrintTable(query:getData())
    end
    
    function afterConnected(database)
      local query1 = database:query("SELECT ID, Name, Cost FROM test WHERE Cost > 0.50")
      query1.onData = function(Q,D) print("Q1") PrintTable(D) end
      query1.onSuccess = printQuery
      query1.onError = function(Q,E) print("Q1") print(E) end
      query1:start()
    
      local query2 = database:query("SELECT ID, Name, Cost FROM test")
      query2.onData = function(Q,D) print("Q2") PrintTable(D) end
      query2.onError = function(Q,E) print("Q1") print(E) end
      query2:start()
    end
    
    function connectToDatabase()
      local databaseObject = mysqloo.connect(DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT)
      databaseObject.onConnected = afterConnected
      databaseObject:connect()
    end
    
    connectToDatabase()

    Usage
    Basic functionality:

    * mysqloo.connect - Create a new database connection
    Parameters: (hostname, username, password, database, port,
    unix socket, client flag)
    Returns: Database object

    Database object:

    * Database:connect - Start connecting to the database
    Parameters: ()
    Returns: Nothing

    * Database:escape - Make text safe for queries
    Parameters: (text)
    Returns: Escaped string

    * Database:abortAllQueries - Aborts all running queries
    Parameters: ()
    Returns: Nothing

    * Database:status - Check database status
    Parameters: ()
    Returns: One of:
    * mysqloo.DATABASE_CONNECTED - (0) - Connected to the database.
    * mysqloo.DATABASE_CONNECTING - (1) - Current is attempting to connect
    * mysqloo.DATABASE_NOT_CONNECTED - (2) - Connection was not successful or has failed
    * mysqloo.DATABASE_INTERNAL_ERROR - (3) - Some internal error occured

    * Database:query - Query the database
    Parameters: (query)
    Returns: Query object

    * Database:onConnected - Callback when connected successfully
    Parameters: ()
    Returns: Nothing

    * Database:onConnectionFailed - Callback when connection could not be established.
    Parameters: (error_message)
    Returns: Nothing

    Query object:

    * Query:start - Start a query running
    Parameters: ()
    Returns: Nothing

    * Query:abort - Abort a query running
    Parameters: ()
    Returns: Nothing

    * Query:getData - Get all data from a query
    Parameters: ()
    Returns: Table containing all the data that has been read so far

    * Query:setOption - Change query options
    Parameters: (Flag, set)
    Flag is one of:
    * mysqloo.OPTION_NUMERIC_FIELDS - (1) - Use numeric fields when presenting data [default:off]
    * mysqloo.OPTION_NAMED_FIELDS - (2) - Use named fields when presenting data [default:on]
    * mysqloo.OPTION_INTERPRET_DATA - (4) - Auto-convert int/float fields to int/float representation [default:on]
    * mysqloo.OPTION_CACHE - (8) - Cache the data after reading it [default:on]

    Returns: Nothing

    * Query:status - Check query status
    Parameters: ()
    Returns: One of:
    * mysqloo.QUERY_NOT_RUNNING - (0) - Query has not been started yet.
    * mysqloo.QUERY_RUNNING - (1) - The query is executing on the database.
    * mysqloo.QUERY_READING_DATA - (2) - The query has been run, and is now reading the data back.
    * mysqloo.QUERY_COMPLETE - (3) - The query has completed (successfully or with an error).
    * mysqloo.QUERY_ABORTED - (4) - The query has been aborted.

    * Query:onData - Callback when a single row has been received
    Parameters: (data_row)
    Returns: Nothing

    * Query:onSuccess - Callback when all data has been received
    Parameters: ()
    Returns: Nothing

    * Query:onFailure - Callback when an error occured
    Parameters: (error_message)
    Returns: Nothing

    * Query:onAborted - Callback when a query was aborted
    Parameters: ()
    Returns: Nothing


    Installation

    * Extract the zip file to your garrysmod\addons directory (ie: c:\steam\steamapps\username\garrysmod\garrysmod\ad dons)
    * Take the libmySQL.dll, and put it in the same directory as HL2.EXE (ie: c:\steam\steamapps\username\garrysmod)
    * Move the files gmsv_mysqloo.dll and gmcl_mysqloo.dll to the garrysmod\lua\includes\modules folder.


    Downloads

    * Binaries
    Windows
    Linux
    Source Code
    Reply With Quote Edit / Delete Windows Vista Sweden Show Events Friendly Friendly x 3 (list)

  32. Post #472

    March 2011
    33 Posts
    The Linux binary for "mysqloo" is not working.
    I tryed nearly everything even downloading the libmysql lib for linux.
    I hope that somone -like it seems Donkie can fix that.
    Greetings, Dark Rising
    Reply With Quote Edit / Delete Windows 7 Germany Show Events

  33. Post #473
    Gold Member
    Fleamonji's Avatar
    April 2010
    627 Posts
    The Linux binary for "mysqloo" is not working.
    I tryed nearly everything even downloading the libmysql lib for linux.
    I hope that somone -like it seems Donkie can fix that.
    Greetings, Dark Rising
    you need to rename the module itself to gmsv_mysql_linux.dll (thanks Chrisaster)
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  34. Post #474
    Gold Member
    Alex_grist's Avatar
    January 2007
    1,054 Posts
    The Linux binary for "mysqloo" is not working.
    I tryed nearly everything even downloading the libmysql lib for linux.
    I hope that somone -like it seems Donkie can fix that.
    Greetings, Dark Rising
    It works.
    Reply With Quote Edit / Delete Mac United Kingdom Show Events Agree Agree x 1 (list)

  35. Post #475

    March 2011
    33 Posts
    It still, doesnt work.
    If it helps, our server is a managed one at NFOservers.
    The difference between before is that the module outputs errors. - No not the lua code.
    It gives errors about 'Missing resources'.
    Greetings, Dark Rising
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Dumb Dumb x 1 (list)

  36. Post #476
    Gold Member
    Lexic's Avatar
    March 2009
    6,118 Posts
    It's more helpful to paste the exact errors you have instead of just saying "I get errors about x"
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Agree Agree x 2 (list)

  37. Post #477
    Hi Jo
    Jo The Shmo's Avatar
    February 2009
    22,848 Posts
    local query = database:query("INSERT INTO player_info (steamid, nick, kills, deaths, join, leave, time) VALUES ('"..pl:SteamID().."', '"..pl:Nick().."', 0, 0, 0, 0, 0)")

    gives me the error:

    Code:
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'join, leave, time) VALUES ('STEAM_0:1:13793540', 'Jo The Shmo', 0, 0, 0, 0, 0)' at line 1
    while

    local query = database:query("INSERT INTO player_info (steamid, nick, kills, deaths) VALUES ('"..pl:SteamID().."', '"..pl:Nick().."', 0, 0)")

    works perfectly.


    Why?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  38. Post #478
    Gold Member
    Lexic's Avatar
    March 2009
    6,118 Posts
    JOIN is a SQL command.
    Reply With Quote Edit / Delete Mac United Kingdom Show Events Informative Informative x 2 (list)

  39. Post #479
    Gold Member
    Fleamonji's Avatar
    April 2010
    627 Posts
    you should probably escape the playername too
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 2 (list)

  40. Post #480
    cixu2's Avatar
    February 2008
    9 Posts
    Hello, i have little code that saves players death count into mysql database. For some reason something "kills" it if there is nothing to do for about 2 minutes or so.

    If you kill yourself for every 30sec or so, it counts them all and saves in database. BUT if you just stand around couple minutes and then kill yourself; nothing.

    Lua file is in autorun/server folder.

    I'am quite new to the world of lua, so any help is appreciated.
    Reply With Quote Edit / Delete Windows 7 Finland Show Events