lundi 4 avril 2016

SQLite and Lua: Selecting column data from given row

I just started learning SQLite. I have a small lua script that checks row and then adds 1, changes row and loops it unless all rows are checked. How can i get single column value from column?

My database:

dbExec(database, "CREATE TABLE IF NOT EXISTS 'houselist'(id INTEGER PRIMARY KEY, houseName TEXT, houseOwner TEXT, housePrice bigint(255), houseForSale TEXT, housePosition TEXT, houseInterior INT)")

for i=1, getFreeID() do
    local result = dbQuery(database, "SELECT * FROM houselist WHERE id = getFreeID()", i)
    print(result)
end

( getFreeID() is my function that counts rows )

I want to get 'houseName' from selected row and print it.

Aucun commentaire:

Enregistrer un commentaire