我要说明LUA和SQL语句。我已经尝试过了,可以显示SELECT或进行UPDATE INSERT ...,但是我不知道如何将唯一返回的select值分配给变量
mysql = require "luasql.mysql"
env = mysql.mysql()
conn = env:connect('table','user','pass','server')
--print(env,conn)
cursor,errorString = conn:execute([[select id from agent where extension = '9072']])
--print(cursor,errorString)
row = cursor:fetch ({}, "a")
while row do
print(string.format("%s", row.id))
row = cursor:fetch (row, "a")
end
-- close everything
cursor:close()
conn:close()
env:close()
我希望这样的事情: 值= 33
答案 0 :(得分:0)
我愿意
EX1