• TMySQL Not initializing
    2 replies, posted
I have the following code to hook up to my database: [lua] function mysqlinitiate() // Hook up to MYSQL database //host, name, password, database tmysql.initialize( localhost, root, zetos, hl2rp ) //------------------------------------------------------------------------------ // Check for the tables, make sure there is a return, if no return create tables. mysqlsetupwhitelist = tmysql.query( "SELECT * FROM hl2rp_whitelist" ) if mysqlsetupwhitelist == nil then tmysql.query( "CREATE TABLE hl2rp_whitelist ( STEAMID varchar(255), CP varchar(255), REBEL varchar(255) ) " ) tmysql.query( "INSERT INTO hl2rp_whitelist VALUES ( test, test, test ) " ) //Create our first row so it does not keep creating table end // Add other tables to be loaded later on. //------------------------------------------------------------------------------- end hook.Add( "Initialize", "mysql", mysqlinitiate ) [/lua] Yet when I set my server up it tells me. [quote] Hook 'mysql' Failed: [@gamemodes\gamemodename\gamemode\init.lua:12] bad argument #1 to 'initialize' (string expected got nil) [/quote] My 12'th line is this one: [lua] tmysql.initialize( localhost, root, zetos, hl2rp ) [/lua] This is a srcds server I installed the libmysql.dll in the orangebox folder and the gm_tmysql.dll in the orangebox->garrysmod->lua->includes->modules just like the instructions said. Any help would be greatly appreciated, thank you!
They have to be in quotation or speech marks eg. "localhost"
Ooooh, haha you mean that's all it is? God I feel stupid now! Thank you so much!
Sorry, you need to Log In to post a reply to this thread.