This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Add a text as variable in a SQL query
#5
You are missing a single quote before " .. medida_param

You can use Lua multi-line string syntax to make it code more readable:
Code:
query = [[
  INSERT INTO test2 (instalacion, medida, usuario, valor)
  VALUES (
    ']] .. instalacion_param .. [[',
    ']] .. medida_param .. [[',
    ']] .. usuario_param .. [[',
    ]] .. valor_param .. [[
  )
]]

log(dbcon:execute(query))

Lua strings can be wrapped in single or double quotes. But MySQL expects parameters to be wrapped in single quotes.
Reply


Messages In This Thread
RE: Add a text as variable in a SQL query - by admin - 19.06.2024, 11:00

Forum Jump: