web sql - COUNT(*) in Web SQL is not working -
i using following code count of records in emp table, code follows :
var mydb = initdb(); mydb.transaction(function(trans) { var query = "select count(*) c emp"; trans.executesql(query, [], function(trans, res) { var count = res.rows[0].c; console.log("--- after count ---"+count); }, errorhandler); }); query giving error : uncaught typeerror: cannot read property 'c' of undefined. how solve issue? appreciate help.
html5.webdb.count=function() { var db = html5.webdb.db; db.transaction(function (tx) { tx.executesql('select count(*) c yourtable', [], function (tx, r) { console.log( r.rows.item(0).c); }, function (tx, e) { alert ("unknown: " + e.message); }); }); }
i use in db, james
Comments
Post a Comment