That's the problem: I want to set the variable "id" number. So what would I output the string from the table on the "id" specified in a variable. What is my mistake?
The idea that would make a button and switch lines. By clicking on the button will change from id = 1 id = 2.
local sqlite3 = require( "sqlite3" )
X = display.contentWidth Y = display.contentHeight
local path = system.pathForFile( "auto.db", system.baseDirectory ) local db = sqlite3.open( path )
local id = 1
sqlRequest = ("SELECT * FROM part_1 WHERE id = ?") sqlRequest:bind_values(id) sqlRequest:step()
for row in db:nrows(sqlRequest) do
local text = row.content
print("Row " .. row.id)
local options =
{
text = text,
x = X/2,
y = Y/2,
width = X,
font = Arial,
fontSize = 50,
align = "center"
}
local t = display.newText( options )
t:setTextColor( 1 )
t.x = X/2
t.y = Y/2
end
db:close() db = nil
Aucun commentaire:
Enregistrer un commentaire