uBiT Posted February 10, 2012 Share Posted February 10, 2012 (edited) Hello, how can i use mysql_query function in other resource? I created export function executeQuery(): function executeQuery(query) if query then allQueries = allQueries + 1 local result = mysql_query(dbHandler, query) if not result then sendSQLLog('>>> MySQL ERROR: ('..mysql_errno(dbHandler)..') '..mysql_error(dbHandler)) return false else return result end end end In local resource(where function is) it returns valid mysql result, but if i use in other resource ex.: local checkLogin = exports['mysql']:executeQuery('SELECT ID FROM accounts WHERE Username = \''..username..'\' AND Password = \''..password..'\' LIMIT 1') it returns only executed string, not mysql result. Edited February 10, 2012 by Guest Link to comment
Kernell Posted February 10, 2012 Share Posted February 10, 2012 mysql_query return handle of result or false. https://wiki.multitheftauto.com/wiki/Mod ... rows_assoc https://wiki.multitheftauto.com/wiki/Mod ... etch_assoc Link to comment
uBiT Posted February 10, 2012 Author Share Posted February 10, 2012 So, if mysql_query success, it returns result and if not - returns false. I known that. I need, to use mysql functions in other resources without connecting to mysql server in each resource. So, with my created function: executeQuery() it returns only string, but not result. EDIT: Nevermind, solved storing mysql results in table and return saved result id. 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