//this creates the database
db.transaction(populateDB, transaction_error, populateDB_success);
function populateDB(tx) {
tx.executeSql('DROP TABLE IF EXISTS Registration');
var sql = "CREATE TABLE IF NOT EXISTS Registration (" + " id INTEGER PRIMARY KEY AUTOINCREMENT," + "name VARCHAR(50), " + "address VARCHAR(50),"+" age INTEGER(2), "+" birthdate DATE, "+" gender VARCHAR(10), "+" hobbies VARCHAR(100), "+" email VARCHAR(50),"+" uname VARCHAR(50),"+" pwd VARCHAR(50))";
tx.executeSql(sql);
tx.executeSql("INSERT INTO Registration (name,address,age,birthdate,gender,hobbies,email,uname,pwd) VALUES ('"+ v1 +"','"+ v2 +"','"+ v3 +"','"+ v4 +"','"+ v5 +"','"+ v6 +"','"+ v7 +"','"+ v8 +"','"+ v9 +"')");}
function transaction_error(tx, error) {
alert("Database Error: " + error);
}
function populateDB_success() {
dbCreated = true;
alert("Successfully inserted");
db.transaction(queryDB, errorCB);
}
This works for me.Try this. May be helpful to you.
Спасибо.