Discord Moderators Pirulax Posted March 5, 2017 Discord Moderators Share Posted March 5, 2017 Hello guys!I know its a little bit stupid question, but i cant get this code to work.. if dbExec(con, "SELECT * FROM groupattach WHERE characterID = ? AND groupID = ?", getElementData(targetPlayer, "char:id"), fraction) == nil then --do something end connection is working, the query is working, but the IF statment not.. i think because it is a table, and it cant be nil? Link to comment
Gordon_G Posted March 5, 2017 Share Posted March 5, 2017 (edited) The dbExec returns a table so, if you want to make something like this you should use : dbExec() -- Like in your code dbPoll() -- Because you need the result of your dbExec And you could use the '#' to count the number of lines into the returned result of your dbPoll If you've any other question, ask here. Edited March 5, 2017 by Gordon_G Link to comment
Discord Moderators Pirulax Posted March 5, 2017 Author Discord Moderators Share Posted March 5, 2017 (edited) so: result = dbPoll(dbQuery(con, "SELECT * FROM groupattach WHERE characterID = ? AND groupID = ?", getElementData(targetPlayer, "char:id"), fraction), -1) if #result == 0 then ---do something end Edited March 5, 2017 by Pirulax Correcting #result = to #result == Link to comment
Gordon_G Posted March 5, 2017 Share Posted March 5, 2017 Hum... Put it in a table.. I don't really understand what you're trying to do. 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