WebSQL无法读取undefined的属性

时间:2016-03-20 07:17:28

标签: jquery html sql database

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);
    });
});

0 个答案:

没有答案