• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Get character mysql information

mayel

New Member
Joined
Sep 11, 2009
Messages
174
Reaction score
2
Location
Stockholm, Sweden
I'm using this code when I want to get data from my mysql database, but it does only work with numbers:

local nameifon, res = 0, db.getResult("SELECT `name` FROM `players` WHERE `id` = 10;")
if res:getID() ~= -1 then
nameifon = res:getDataInt('name')
res:free()
end

Any idea?
 
Use getDataString, if you are fetching a non-number column.
And for a small perfomance boost, add LIMIT 1 at the end of query (before ;).
 
Back
Top