Hello guys,
I’m stuck on updating my database, it doesn’t update. I tested my SQLite statement in a database browser it works, but when I’m emulating it, it doesn’t update anymore here my code
--Database creation local path = system.pathForFile ("playerDB.sqlite" , system.DocumentsDirectory) local db = sqlite.open(path) local sql =[[CREATE TABLE IF NOT EXISTS player\_Achievement ( id\_Num INTEGER PRIMARY KEY, player\_ID INTEGER, --foreign key coll\_2k INTEGER, coll\_3k INTEGER, coll\_5k INTEGER, lastColl INTEGER, hint1 INTEGER, hint2 INTEGER, hint3 INTEGER, hint4 INTEGER, acientFin INTEGER, middleFin INTEGER, earlyFin INTEGER, modernFin INTEGER, gameFin INTEGER, totalPoint INTEGER );]] print ("achievement DB is created") db:exec(sql) db:close()
--My SQLite statement local path = system.pathForFile ("playerDB.sqlite",system.DocumentsDirectory) local db = sqlite.open(path) local sql = "(UPDATE player\_Achievement SET coll\_2k =" .. param1 .. ", coll\_3k =" .. param2 .. ", coll\_5k =" .. param3 .. " , lastColl =" .. param4 .. " , totalPoint =" .. totalPoint .. " WHERE player\_ID =" .. playerID .. ");" print (sql) db:exec(sql) print ("successfully updated player achievement DB") db:close()
Thanks in advance,
Jam