Database one time update whenever loading the app

What happens is whenever I run my app, I insert a new record in my database for one time only, but whenever I open the app, data keeps on inserting, here’s my code

--Open PlateNumbers.db. If the file doesn't exist it will be created local path = system.pathForFile("PlateNumbers.db", system.DocumentsDirectory) db = sqlite3.open( path ) local tblPlates = [[CREATE TABLE IF NOT EXISTS Plates (id INTEGER PRIMARY KEY, platenum);]] db:exec(tblPlates) --Insert Data local tablefill = [[INSERT INTO Plates VALUES (null,'ILY-143');]] db:exec(tablefill) --Reads all Data for row in db:nrows([[SELECT \* FROM Plates WHERE platenum LIKE '%]]..day..[[' OR platenum LIKE '%]]..day2..[[']]) do

so basically ones opened it keeps on creating a new one

Im having the exact same problem buddy.

You have to do a test to see if you can read the database and read records out of it, if so skip the insertion of the first record and creation of the table. 

Rob

Im having the exact same problem buddy.

You have to do a test to see if you can read the database and read records out of it, if so skip the insertion of the first record and creation of the table. 

Rob