Sacarus
Member
- Joined
- Mar 15, 2016
- Messages
- 52
- Reaction score
- 7
Hi, sorry for the dumb question, but I just cant get the number of rows returned by a select. I tried using while result.next(data) and it loops just two times, executing the same code in sql returns 4 rows.
The following code prints "false". Does anyone know how to get that COUNT(*) ?? Any other way to get the total of rows returned gonna work, just tell me if you know some.
Thank you!
The following code prints "false". Does anyone know how to get that COUNT(*) ?? Any other way to get the total of rows returned gonna work, just tell me if you know some.
Lua:
local data= db.query("SELECT COUNT(*) FROM(SELECT * FROM `player_coins` WHERE `player_id` = 1) x")
if data~= false then
local lines= result.getDataInt(data, "COUNT(*)")
print(lines)
end