9951 explained code solutions for 126 technologies


lua-mysqlHow to insert data


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

db:execute('INSERT INTO test SET name = "Donald"')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

INSERT INTO test SET name = "Donald"

sample INSERT query to execute