Hi, i was looking at http://wiki.nginx.org/HttpLuaModule#ngx.location.capture_multi
and i like to call several queries
[code]
local function query_mysql(query)
local db = mysql:new()
if not db then
ngx.say("failed to instantiate mysql: ", err)
return
end
local ok, err, errno, sqlstate = db:connect{
host = "127.0.0.1",
port = 3306,
database = "jmdb",
user = "ngx_test",
password = "ngx_test"
}
if not ok then
ngx.say("failed to connect: ", err, ": ", errno, " ", sqlstate)
return
end
local query_res, err, errno, sqlstate = db:query(query)
if not res then
ngx.say("bad result: ", err, ": ", errno, ": ", sqlstate, ".")
return
end
db:set_keepalive(0, 100)
end
[/code]
so this is what i have so far but i cant seem to be able to capture the table into a variable!
all this because i'm trying not to repeat this part of code several times in the same location block what's the best way of dooing it?