How to concatenate multiple values in Lua?

Hi,

I’m trying to update Sqlite database at one point using

local q = ("UPDATE main SET status=1 WHERE route\_id=" .. routeId) db:exec( q )

And this one works just fine. The problem is, when I would like to include two variables into the query. 

local q = ("UPDATE main SET topHeight=" .. tmpHeight .. "WHERE route\_id=" .. routeId) db:exec( q )

Can anyone help please?

If you where to do 

print (q)

you would notice there is no space in front of WHERE.

For future debugging I would recommend using something like Firefox SQLite plugin to open the database and running your queries there (after doing print(q) ). Corona is not going to give you any useful SQLite errors when there is a problem with your query.

uh, thank you very much jonjonsson, I realy appreciate this. it works great now. I trying to solve this for 2 days now. :slight_smile:

:slight_smile:

If you where to do 

print (q)

you would notice there is no space in front of WHERE.

For future debugging I would recommend using something like Firefox SQLite plugin to open the database and running your queries there (after doing print(q) ). Corona is not going to give you any useful SQLite errors when there is a problem with your query.

uh, thank you very much jonjonsson, I realy appreciate this. it works great now. I trying to solve this for 2 days now. :slight_smile:

:slight_smile: