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

Lua Compare sql result with null

Godshiryu

New Member
Joined
Mar 15, 2010
Messages
40
Reaction score
0
Hi,
Anyone can tell me how should I compare a result of a line on DB to null?
For example:
db.getResult("SELECT `id` FROM `accounts` WHERE `id` = "74712885";")
This will return NULL on mysql, how should I verify this with an if?
I'm trying like this:
local status = db.getResult("SELECT `id` FROM `accounts` WHERE `id` = "74712885";")
if status == 0 then
xxx
end

And I can't.
I didn't find this in any place, can anyone help me?
Sorry for my bad english, i'm from Brazil.
Thanks!
 
Well, If anyone need anything like this...
I solve my problem this way:

local status = db.getResult("SELECT count(`id`) FROM `accounts` WHERE `id` = "74712885";")
local infor = status:getDataInt("count(`id`)")
if infor == 0 then
...
Thanks, can close the topic!
 
Back
Top