Hello, I am trying to fetch varchar from database:
Whats the problem?
Is there maybe any way to have SQL query which get only name (not * - everything)? I think it should be more efficient
Code:
local getFlag = db.getResult("SELECT * FROM `accounts` WHERE `id` = " .. getPlayerGUID(cid) .. ";")
if (getFlag:getDataString("name") == "12311") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Hello Master!')
getFlag:free()
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Hello!')
getFlag:free()
end
Code:
[17:26:45.703] [Error - CreatureScript Interface]
[17:26:45.703] data/creaturescripts/scripts/login.lua:onLogin
[17:26:45.708] Description:
[17:26:45.708] data/lib/004-database.lua:82: [Result:getDataString] Result not set!
[17:26:45.718] stack traceback:
[17:26:45.723] [C]: in function 'error'
[17:26:45.723] data/lib/004-database.lua:82: in function 'getDataString'
[17:26:45.728] data/creaturescripts/scripts/login.lua:41: in function <data/creaturescripts/scripts/login.lua:7>
Whats the problem?
Is there maybe any way to have SQL query which get only name (not * - everything)? I think it should be more efficient