Dimos7 Posted October 23, 2016 Share Posted October 23, 2016 (edited) <meta> <script src="server.lua" type="server"/> <export function="_Query" type="server"/> <export function="_QuerySingle" type="server"/> <export function="_Exec" type="server"/> </meta> local connection = nil addEventHandler("onResourceStart", resourceRoot, function(resource) connection = dbConnect("mysql", "databse=mtarp; host=127.0.0.1; port=3306;", "root", "9852174563") if connection then outputDebugString(getResourceName(resource).. ":connected to database.") return true else outputDebugString(getResourceName(resource).. ":unable to connect to database. Please contact Developer.") return false end end ) function _Query(...) if connection then local query = dbQuery(connection, ...) local result = dbPoll(query, -1) return result else return false end end function _QuerySingle(str, ...) if connection then local result = _Query(str, ...) if type(result) == 'table' then return result[1] end else return false end end function _Exec(str, ...) if connection then local query = dbExec(connection, str, ...) return query else return false end end server line 37 dbExec failed; no databse selected server line 17 dbPoll no database selected Edited October 23, 2016 by Dimos7 Link to comment
3aGl3 Posted October 23, 2016 Share Posted October 23, 2016 It seems like you have a SQL error rather than a script error. Link to comment
Dimos7 Posted October 23, 2016 Author Share Posted October 23, 2016 (edited) the theme is when restart the resource say it connected to databse Edited October 23, 2016 by Dimos7 Link to comment
Dimos7 Posted October 23, 2016 Author Share Posted October 23, 2016 the them is when restart the resource say it connected to databse also teh xampp mysql running so its not that that mysql need put it on admin group acl? Link to comment
pa3ck Posted October 24, 2016 Share Posted October 24, 2016 Read this line: connection = dbConnect("mysql", "databse=mtarp; host=127.0.0.1; port=3306;", "root", "9852174563") There's a typo in "database=mtarp" and it shouldn't be database anyway, it should be: connection = dbConnect("mysql", "dbname=mtarp; host=127.0.0.1; port=3306;", "root", "9852174563") 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