So far in my app development (phonegap/JQuery Mobile) I have setup a database and have a table created to which I have implemented a few functions that interact with the table for different events e.g. user registration.
However, I need to create another table within the same database however I'm not sure how to go about this.
I attempted to created another function (createEvent(tx) {) that creates a table however that isn't working.
Please see my javascript below which builds the database and creates the table with.
document.addEventListener("deviceready", onDeviceReady, false);
var db;
function onDeviceReady() {
db = window.openDatabase("SoccerEarth", "2.0", "SoccerEarthDB", 2*1024*1024);
db.transaction(createDB, createEvents, errorCB, successCB);
}
function createDB(tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS SoccerEarth (UserName text, FirstName text, LastName text, Email text, Password text, CPass text)');
}
function createEvents(tx) {
tx.execute2('CREATE TABLE IF NOT EXISTS SoccerEvents (Title text, Location text, NoPeople text, Date text, Description text)');
}
function errorCB(err) {
alert("Error processing SQL: "+err.code);
}
function successCB() {
alert("Database Ready!");
}