I only want the update query to be executed if the "VacantSpaces" is not 0. So in other words, once there is no longer any spaces for a specific event "VacantSpaces" will be 0 so the idea is that users should not be able to join and the number will not go -1, -2 etc.
However I am not quite sure how to go about this.
JavaScript Function:
function updateEvent(title) {
db = window.openDatabase("SoccerEarth", "2.0", "SoccerEarthDB", 2 * 1024 * 1024);
db.transaction(function(tx) {
tx.executeSql("Update EventSoccer SET VacantSpaces = VacantSpaces -1, NoPeople = NoPeople +1 WHERE Title = '" + title + "'", [], successJoin,errorCB);
});
function successJoin() {
navigator.notification.alert("You have joined the event!", null, "Information", "ok");
$( ":mobile-pagecontainer" ).pagecontainer( "change", "#page4" );
}
}
Aucun commentaire:
Enregistrer un commentaire