1

I cannot get javascript to connect to an existing sqlite database that I created and saved as a file with sqlite manager firefox extention.

This is my code but nothing is happening:

$(function() {
    var db;
    if(!window.openDatabase)
        alert('Sqlite not supported');
    else {
        db = window.openDatabase("testDb", "1.0", "DB", 1000000);        

        $("#resultList").html('');
        db.transaction(function(tx) {              
            tx.executeSql('SELECT * FROM users', [], function(tx, result) {
                var dataset = result.rows;
                alert(result.rows.length - 1);
                for(var i = 0; i < dataset.length; i++) {
                    $("#resultList").append("<li>"+dataset.item(i)+"</li>");
                }
            });
        });
    }    
});

Not even the alert in tx.executeSql is alerting.

How do I do this then?

Charl Meyers
  • 115
  • 1
  • 8

0 Answers0