steadyfi Posted April 10, 2015 Share Posted April 10, 2015 Hello ! I've got a little problem here with dbQuery. I can't seem to understand how to pass the results correctly to the callbackFunction. Code: dbQuery(function(deaths, matches) dbExec(db, "UPDATE main SET deaths=?, matches=? WHERE account=?", tonumber(deaths) + 1, tonumber(matches) + 1, getAccountName(getPlayerAccount(source))) end, {deaths, matches}, db, "SELECT deaths,matches FROM main WHERE account=? LIMIT 1", getAccountName(getPlayerAccount(source))) SQL Table: I have everything set. There you can also see ROW Properties. Error: [2015-04-10 14:40:50] ERROR: ***\main_s.lua:92: attempt to perform arithmetic on a nil value Thanks ! Link to comment
WhoAmI Posted April 10, 2015 Share Posted April 10, 2015 dbQuery ( function ( q, player ) local p = dbPoll ( q, 0 ); if ( p ) then dbExec ( db, "UPDATE `main` SET `deaths`=?, `matches`=? WHERE `account`=?", tonumber ( p[1]["deaths"] ) + 1, tonumber ( p[1]["matches"] ) + 1, getAccountName ( getPlayerAccount ( player ) ) ); end end, {source}, db, "SELECT `deaths`,`matches` FROM `main` WHERE `account`=? LIMIT 1", getAccountName ( getPlayerAccount ( source ) ) ); Link to comment
steadyfi Posted April 10, 2015 Author Share Posted April 10, 2015 Thanks WhoAmI ! #SOLVED 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