Chris!i! Posted March 4, 2016 Share Posted March 4, 2016 local sql = dbConnect( "mysql", "dbname=ingame;host=127.0.0.1;port=22003", "root", "24835100a") dbExec ( sql, "CREATE TABLE IF NOT EXISTS selling ( userid TEXT, item TEXT, amount NUMBER, price NUMBER )" ) function getConnection() return sql end function query(...) if isElement(sql) then local qh = dbQuery(sql,...) return dbPoll(qh,-1) end return false end function querySingle(str,...) if not str:find("LIMIT 1") then str = str.." LIMIT 1" end local result = query(str,...) if result then return result[1] end return false end function exec(str,...) if isElement(sql) then return dbExec(sql,str,...) end return false end function doesColumnExist(aTable,column) local theTable = query("DESCRIBE `??`",aTable) if theTable then for k, v in ipairs(theTable) do if v.Field == column then return true end end end return false end function creatColumn(aTable,aColumn,aType) if aTable and column and aType then return exec("ALTER TABLE `??` ADD `??` ??",aTable,aColumn,aType) end end WARNING: mysql.lua:4: Bad argument @ 'dbExec' [Expected db-connection at argument 1, got boolean] This script is preventing another scripts to not work, please i need help. Link to comment
1LoL1 Posted March 4, 2016 Share Posted March 4, 2016 dbExec ( sql, "CREATE TABLE IF NOT EXISTS selling (userid INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, item VARCHAR(30), amount INT(6), price INT(6))" ) Link to comment
Bonus Posted March 4, 2016 Share Posted March 4, 2016 There is no connection -> dbConnect didn't work. "Returns a database connection element unless there are problems, in which case it return false." You sure dbname, host etc. is right? Link to comment
S.L.C Posted March 4, 2016 Share Posted March 4, 2016 Do you have the MySQL server installed and and started? Do you have the database created and a user that can access and/or modify that database? Normally you should check the 'sql' (bad choice of naming though!!!) against NULL values to be sure you have a working connection before you even try anything else. Validate things people! You're working with a weakly typed language. Link to comment
Noki Posted March 5, 2016 Share Posted March 5, 2016 Why are you connecting via port 22003? The default MySQL port is 3306 - use that instead. Also, this code looks so damn familiar. In fact, it's line for line exactly the same as CSG's. That's reverse engineering to a whole new level! Link to comment
Chris!i! Posted March 5, 2016 Author Share Posted March 5, 2016 We don't have an database account @S.L.C We are trying to make one but ok listen, i'll explain everything here. We bought our vps from ovh.com They gave us our control panel info ONLY. And to create a database account we need to create another account, and we cant use our control panel account, i created another account for managing and creating a database account but the problem is that the new account doesnt have anything... like our vps to edit it or manage it.. So we got a big problem stuck on this for 6 days, we got a person who knows in database and he couldnt make it since he needs our database name database hostname database password And we dont have any of these So we are trying to link those 2 accounts so we can host a database on our vps, but couldnt fuck this Link to comment
Chris!i! Posted March 5, 2016 Author Share Posted March 5, 2016 Sorry but i dont understand anything of MySQL or database, What i did is that i got this script from my friend. Link to comment
Captain Cody Posted March 5, 2016 Share Posted March 5, 2016 Usually 'Got this script from a friend' = it's stolen in one way or another. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now