• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Get more than 1 result. (db.getResult)

Nothxbye

Banned User
Joined
Jan 22, 2012
Messages
1,124
Reaction score
174
Hello Guys,
I've got a question. It's possible to get more than 1 result in one time using "db.getResult"?
For example i want to get EVERY house id if someone is owner in one script exute.
I tried with loop and insert it to table but doesn't work for me, like here:

Code:
for i = 1, 3 do
local result = db.getResult('SELECT `id` FROM `houses` WHERE `owner` > 0)
end
local tbl = {}
table.insert(tbl, result:getDataInt("id"))

Is possible to get that effect in another way? Or same way but correct.
 
LUA:
local result = db.getResult('SELECT `id` FROM `houses` WHERE `owner` > 0')
if result:getID() ~= -1 then
	while(true) do
		--here comes your code
	if not result:next() then break end
	end
end
 
Last edited:
Back
Top