My populateDB method runs well and when I look into the database the values are stored, but when insertQueryDB method is not working when I am trying to insert data from a form so I think my Insert query is wrong but I type it over many times and watch the correct format but it's still not storing the values from the form in the database when I click submit.
function populateDB(tx) {
//navigator.notification.alert("Start Populating");
tx.executeSql('DROP TABLE IF EXISTS dataEntryTb');
tx.executeSql('CREATE TABLE IF NOT EXISTS dataEntryTb (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, activityName TEXT NOT NULL, location TEXT NOT NULL, time NOT NULL, date NOT NULL, reporter NOT NULL)');
tx.executeSql('INSERT INTO dataEntryTb ( activityName, location, time, date, reporter) VALUES ( "Tony", "tony@testgmail.com", "5555", "today", "james")');
tx.executeSql('INSERT INTO dataEntryTb ( activityName, location, time, date, reporter) VALUES ( "d", "d@testgmail.com", "5555", "today", "james")');
//navigator.notification.alert("Finished Populating");
}
insertQueryDB METHOD
function insertQueryDB(tx) {
var an = document.forms["myForm"]["activityName"].value;
var l = document.forms["myForm"]["location"].value;
var t = document.forms["myForm"]["time"].value;
var d = document.forms["myForm"]["date"].value;
var r = document.forms["myForm"]["reporter"].value;
var query = 'INSERT INTO dataEntryTb ( activityName, location, time, date, reporter) VALUES ( "'+an+'", "'+l+'", "'+t+'", "'+d+'", "'+r+'")';
navigator.notification.alert("Retrieved the following: Activity Name="+an+" and Location="+l);
tx.executeSql(query,[], insertQuerySuccess, insertQueryFail);
}