Trying to populate JavaScript database via variables

This puts the new_id in, but leaves the other vars all blank:

tx.executeSql(‘INSERT INTO DEMO (id, data1, data2, data3) VALUES (\"’ + new_id + ‘\"’ + ‘, \"’ + formdata1Get + ‘\", \"’ + formdata1Get + ‘\", \"’ + formdata1Get + ‘\")’);

innerHTML display:
ID = 1395181245363
data1 =
data2 =
data3 =

THIS WORKS!

function populateDB(tx) {
	console.log("4. populateDB(tx) begins");
	var d = new Date();
	var new_id = d.getTime(); // set the current time as the id
	console.log("id = " + new_id);
	var formdata1Get = localStorage.getItem('formdata1Set'); // get data from localStorage
	var formdata2Get = localStorage.getItem('formdata2Set');
	var formdata3Get = localStorage.getItem('formdata3Set');
    tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id TEXT NOT NULL, data1 TEXT NULL, data2 TEXT NULL, data3 TEXT NULL)');
	var query1 = "INSERT INTO DEMO (id, data1, data2, data3) VALUES ";
	var query2 = "(\\"" + new_id + "\\", \\"" + formdata1Get + "\\", \\"" + formdata2Get + "\\", \\"" + formdata3Get + "\\")";
	var query = query1 + query2;
	tx.executeSql('INSERT INTO DEMO (id, data1, data2, data3) VALUES (\\"' + new_id + '\\"' + ', \\"' + formdata1Get + '\\", \\"' + formdata2Get + '\\", \\"' + formdata3Get + '\\")');
	queryDB(tx);
}

Unfortunately, the data is not retained in a device when the app is exited. In a device, it behaves just like sessionStorage.

Also, as it stands, the data is repeated with each submission with the “innerHTML+=” scripting – it repeats all the earlier submissions as well as the latest one.

Back to the drawing board!

I have an idea on how to fix this!