I'm using web sql to store and retrieve data to and from a mobile device's local memory. I wrote the following query for the retrieval part which works just fine
Code:
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:
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?