9951 explained code solutions for 126 technologies


lua-mysqlHow to update data


mysql = require "luasql.mysql"
local pool = mysql.mysql()
local db = pool:connect('test', 'usr', 'pwd')

db:execute('UPDATE test SET name = "Bill" WHERE id = 14')ctrl + c
require "luasql.mysql"

includes mysql module to work with database

mysql.mysql()

init Mysql connection

pool:connect

connect to Mysql server based on specified credentials

db:execute

executes given query and returns cursor to iterate through results

'UPDATE test SET name = "Bill" WHERE id = 14'

sample UPDATE query