This is the code. I tried exploring the options of SQL for solving this, but they are limited. I want to pass newSync[i].id to the onsuccess callback function, but I fail Code: tx.executeSql('SELECT * FROM bookmarks WHERE bookmarkID = ?', [newSync[i].id], function(tx,results){ console.log('results.rows.item(0).bookmarkID', results.rows.item(0).bookmarkID); tx.executeSql('UPDATE bookmarksSync SET thumbnail=?, ts_created=?, visits=?, visits_morning=?, visits_afternoon=?, visits_evening=?, visits_night=?, position=?, idgroup=? WHERE bookmarkID=?', [results.rows.item(0).thumbnail, results.rows.item(0).ts_created, results.rows.item(0).visits, ...