I have a webapp that I\'m building, and have just started with SQLite. I have been able to create my form, open the database I created, create the table, and fields i need, and
See the spec and this Apple tutorial. In short, you need to add data and error callbacks. Also, you should be passing an empty array (or null) because your query has no parameters.
db.transaction(function(tx) {
tx.executeSql('SELECT * FROM Drinks',
[],
function(tx, results)
{
// results is a http://dev.w3.org/html5/webdatabase/#sqlresultset .
// It has insertId, rowsAffected, and rows, which is
// essentially (not exactly) an array of arrays.
},
function(tx, error)
{
}
);
});
It's up to you whether to use named or anonymous functions.
EDIT: I made a working demo at http://jsfiddle.net/WcV6Y/7/ . It's tested in Chrome 5.0.375.70.
try something like this
tx.executeSql('SELECT * FROM foo', [], function (tx, results) {
var len = results.rows.length;
for (var i = 0; i < len; ++i) {
var obj = results.rows.item(i);
alert(obj);
}
});
also see this for short tutorial http://html5doctor.com/introducing-web-sql-databases/