Code: Select all
var sql = "SELECT * FROM messages ORDER BY timestamp DESC LIMIT 0,20";
transaction.executeSql (sql, undefined, function (transaction, result){
//Get rows
});
But I want to use variables in place of the numbers because the code will be reused in several different instances. So my new code reads like this
Code: Select all
var index = 0;
var lim = 20;
var sql = "SELECT * FROM messages ORDER BY timestamp DESC LIMIT index,lim";
transaction.executeSql (sql, undefined, function (transaction, result){
//Get rows
});
Unfortunately, this doesn't work and I don't even get any errors. Who knows what I'm doing wrong? :whistling: