I am just starting out with WebOS development and I'm trying to create a simple hangman app to understand how to create an app. I ran into a little bit of a problem with the mojo storage databases. I referred to the help here: Mojo Storage Database - WebOS Internals but I guess I'm still doing something wrong.

here is my code:

	var db= openDatabase("hangManDB", 1, "HangMan DB", 200000);
		var word;
	if (!db)
		this.controller.showAlertDialog({onChoose:function(whatever){},title:"Oops!",message:"There was an error! Please try again!",choices:[{label:"Ok",value:"Ok",type:"dismiss"}]});

            function(tx) {



                        tx.executeSql("CREATE TABLE IF NOT EXISTS 'HangMan' (id REAL UNIQUE, categoryId REAL, categoryName TEXT, word TEXT, Hint TEXT)", [], null, null);

                        tx.executeSql("INSERT INTO HangMan (categoryId, categoryName, word, hint) values(?, ?, ?, ?)", [1, "Hollywood", "Hannah", "2011" ],  function(transaction, results) {    // success handler
                           Mojo.Log.info("Successfully inserted record"); 
                         function(transaction, error) {      // error handler
                           Mojo.Log.error("Could not insert record: " + error.message);



            function(tx) {

                tx.executeSql("SELECT * FROM HangMan", [],

                    function(tx, result) {
                              word = '<b>' + result.rows.item(1).word + '</b><br />';
                    }, null);


            this.controller.get('divTest').innerHTML = word;
The result I get for divTest is undefined. Any idea why?