UID works just like a normal id.
I’ll ask a little different.
function fun1 ()
dbSecurityConnection = dbConnect( 'sqlite', 'accs.db')
local getAnswerData = dbQuery( dbSecurityConnection, ' SELECT `email` FROM `accs` WHERE uid = ? ', 1 )
local result = dbPoll( getAnswerData, -1 )
local finduid = result[1].email
outputChatBox ( ""..finduid.."" )
end
addCommandHandler ( "tt", fun1 )
If I use this code, I use "1" in line
local getAnswerData = dbQuery( dbSecurityConnection, ' SELECT `email` FROM `accs` WHERE uid = ? ', 1 )
I will get the output in chat: "mail.ru"
if i use "2" in line
local getAnswerData = dbQuery( dbSecurityConnection, ' SELECT `email` FROM `accs` WHERE uid = ? ', 2 )
i will get the output in chat: "dat.ru"
It all works as planned BUT if i use "3" in line:
local getAnswerData = dbQuery( dbSecurityConnection, ' SELECT `email` FROM `accs` WHERE uid = ? ', 3 )
As you can see on the screen of the database, there is no such line(with uid "3")
A question: How can I make it so that when I type a non-existent UID in the database, I get an error in the chat NOT in code like this:
I wanted to use something like this, but it not working:
function fun1 ()
dbSecurityConnection = dbConnect( 'sqlite', 'accs.db')
local getAnswerData = dbQuery( dbSecurityConnection, ' SELECT `email` FROM `accs` WHERE uid = ? ', 3 )
if getAnswerData then
local result = dbPoll( getAnswerData, -1 )
local finduid = result[1].email
outputChatBox ( ""..finduid.."" )
else
outputChatBox ( "error" )
end
end
addCommandHandler ( "tt", fun1 )