javascript - Data erased from Sqlite db when moving from page to another -


I use phonegap to create an application for Android & amp; IOS I store my database using SQL database. I have a main JavaScript file that includes DB & amp; The main functions are written, then on the second page I put the database function related to that page.

The problem is that when I do some work on DB from another page, go to the next page & amp; Retrieve data, I think before anything that I made was erased and it only brings data from the main javascript file

I wonder how the data can be saved Can and am Whenever I'm known from one page to another, stop it from being removed

The main JavaScript file that I use on all pages, is this for DB initialization:

  function populateDB (tx) {tx.executeSql ('DROP TABLE if existing table'); }   

Is this a problem? Whenever I use DB, should I always stop leaving the table? But if I removed it, what should I do first time when I make DB?

Yes, you drop the table every time you go to the next page, you have Data was lost from the page. First of all you should first make the DB table like below.

  Function PopularDB (tx) {tx.executeSql ('Create table if table does not exist (id integer)'); }    

Comments