Cocodrilo Posted March 25, 2016 Share Posted March 25, 2016 How to get a string value from a column db? something like this: local q = dbQuery(con, "SELECT * FROM t_ayuntamiento WHERE Cuenta=?",Cuenta) local result = dbPoll(q,-1) if tostring(result) == "Cocodrilo" then outputChatBox(result.. " is into db") end Link to comment
KariiiM Posted March 25, 2016 Share Posted March 25, 2016 Oboviously dbPoll is a table, you have to loop it to get the specify value Link to comment
Cocodrilo Posted March 25, 2016 Author Share Posted March 25, 2016 so how would it be? any function or example? Link to comment
Tox Posted March 26, 2016 Share Posted March 26, 2016 you can either loop; for key, value in ipairs (result) do outputChatBox(value.Cocodrilo.. " is into db") end or use the column name as lua index; outputChatBox (result[1].Cocodrilo.. "is into db") Link to comment
Simple0x47 Posted March 26, 2016 Share Posted March 26, 2016 you can either loop; for key, value in ipairs (result) do outputChatBox(value.Cocodrilo.. " is into db") end or use the column name as lua index; outputChatBox (result[1].Cocodrilo.. "is into db") I'll recommend to you to use the second method as it's fastest than the first one. Link to comment
KariiiM Posted March 26, 2016 Share Posted March 26, 2016 I'll recommend to you to use the second method as it's fastest than the first one. local q = dbQuery(con, "SELECT * FROM t_ayuntamiento WHERE Cuenta=?",Cuenta) local result = dbPoll(q,-1) local data = result[1] --Define result[1] with data instead of repeating it everytime needed. outputChatBox (data.Cocodrilo.. "is into db") 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