I'm building a cordova project in which I have created a database The database includes a table for which I want to insert ID column for table when window is loaded... The problem I'm facing is every time I load the page same ID's are getting inserted...... And I want to insert only once after that whenever I load the page ID's must not get inserted .... Code is given below
window.onload = function(){
db = openDatabase('Timetable', '1.0', 'Time Table', 10 * 1024 * 1024);
db.transaction(function (tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS schedule(ID INT PRIMARY KEY NOT NULL,monday TEXT,tuesday TEXT,wednesday TEXT,thursday TEXT,friday TEXT,saturday TEXT,sunday TEXT)');
for (var i=1;i<=24;i++){
tx.executeSql('INSERT INTO schedule(ID) VALUES(?)',[i]);
}
}
Output : Output of database Output of database