• 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!

getGuildNameById(id)

PHBS

New Member
Joined
Mar 25, 2009
Messages
28
Reaction score
0
getGuildNameById(id):
PHP:
function getGuildNameById(id)
local Info = db.getResult("SELECT `name` FROM `guilds` WHERE `id` = " .. id .. ";")
        if Info:getID() ~= LUA_ERROR then
        local Name= Info:getDataString("name")
                                Info:free()
                return Name
        end
        return LUA_ERROR
end

:thumbup:
 
Last edited:
Shawak you misread it, he wants the opposite of this

Lua:
	getGuildId(guildName)

I'm sure you don't really need it, there could be a work around, mind posting your script, then we could help you more.
 
Shawak you misread it, he wants the opposite of this

Lua:
	getGuildId(guildName)

I'm sure you don't really need it, there could be a work around, mind posting your script, then we could help you more.

I just read "getplayer...id" ah fucked ;).
 
Lua:
function getGuildNameById(id)
local query = db.getResult("SELECT `name` FROM `guilds` WHERE `id` = " .. id .. ";")
	if(query:getID() ~= -1) then
		return query:getDataString("name")
		query:free()
	end
	return LUA_ERROR
end

Untested.
 
Lua:
function getGuildNameById(id)
local query = db.getResult("SELECT `name` FROM `guilds` WHERE `id` = " .. id .. ";")
	if(query:getID() ~= -1) then
		return query:getDataString("name")
		query:free()
	end
	return LUA_ERROR
end

Untested.

Don't work ;/
 
HaHa!
This works...
PHP:
function getGuildNameById(id)
local Info = db.getResult("SELECT `name` FROM `guilds` WHERE `id` = " .. id .. ";")
        if Info:getID() ~= LUA_ERROR then
        local Name= Info:getDataString("name")
                                Info:free()
                return Name
        end
        return LUA_ERROR
end
Thanks, ALL!
 
Last edited:
Lua:
function getGuildNameById(id)
local query = db.getResult("SELECT `name` FROM `guilds` WHERE `id` = " .. id .. ";")
	if(query:getID() ~= -1) then
		return query:getDataString("name")
		query:free()
	end
	return LUA_ERROR
end

Untested.

query:free() cant be ran after returning.
 
Back
Top