Getting Data from SQLite

Hey there,

i’m building an app using ListView and TabBar.

I’m pulling data from a sqlite db.

When i have my select statement like this

“SELECT * FROM games”

It pulls everything fine and looks nice.

Now what i’m getting stuck with, is pulling data based on its platform.

when i change the select statement to this:

“SELECT * FROM games WHERE platform = 2”

It only returns the first result and nothing else. It should be returning more than 1.

local path = system.pathForFile("game.sqlite", system.TemporaryDirectory)  
db = sqlite3.open( path )  
  
-- Open Array  
local data = {}  
  
--Begin SQL  
local sql = "SELECT \* FROM games WHERE platform = 3"  
  
for row in db:nrows(sql) do   
  
-- setup some data  
 data[row.id] = row.title  
end  

Any help would be amazing, thanks :smiley: [import]uid: 97707 topic_id: 16553 reply_id: 316553[/import]

are u sure row.id is always start from 1 and increment by 1 ?

i dont think so
:slight_smile: [import]uid: 12482 topic_id: 16553 reply_id: 61819[/import]