db.transaction(function (tx) {
tx.executeSql(
"SELECT COUNT(*) as id FROM offline_post WHERE link=? and author=? and title=?",
[link, create, title],
function (tx, results) {
alert(results.rows[0].id);
}
);
});
无法读取未定义
的属性'id'
解决
我用这种方式解决了问题:)
db.transaction(function(tx) {
tx.executeSql('SELECT * FROM offline_post', [], function(tx, results) {
//resolve the promise passing the count data
alert(results.rows.length);
});
});