I want to query in optimize way in a function
I need to retuen value
what is the wrong with this code
function get_lyl_member_max_id() {
db.transaction(function(tx) {
sql = "SELECT max(id) as mid FROM lyl_member ";
console.log(sql);
tx.executeSql(sql, [],function(tx, results) {
if (results.rows.length0)
{
var row = results.rows.item(0);
alert(row['mid']);
return row['mid'];
}
},errorHandler);
Code: Select all
}); }
function errorHandler(tx, error)
{
alert('Oops. Error was ' + error.message + ' (Code ' + error.code + ')');
// Handle errors here
Code: Select all
var we_think_this_error_is_fatal = true;
if (we_think_this_error_is_fatal) return true;
return false; }