07.09.2017, 13:54
(14.01.2016, 10:03)admin Wrote: Install packages:
https://dl.openrb.com/pkg/zlib_1.2.7-1_mxs.ipk
https://dl.openrb.com/pkg/libmysqlclient...-1_mxs.ipk
https://dl.openrb.com/pkg/liblua-mysql_2.2.0-2_mxs.ipk
Docs:
http://keplerproject.github.io/luasql/do...anual.html
Short example, don't use db as a variable name or you will mess up LM internal database connection
Code:require('luasql.mysql')
env = luasql.mysql()
dbcon = env:connect(DB_NAME, USERNAME, PASSWORD, MYSQL_SERVER_IP, MYSQL_SERVER_PORT)
cursor = dbcon:execute('SELECT * FROM mytable')
while true do
row = cursor:fetch({}, 'a')
if row then
log(row)
else
break
end
end
cursor:close()
dbcon:close()
env:close()
Hi a question
as that table select as in your case "select * from mytable"
where do you get
the user, password, dbname, server and port for function connect?