$cordovaSQLite delete syntax

Hi guys, I am trying to delete a row of data from my SQLite table, I have been using the following syntax. NB. itemIndex is a passed parameter into a function where this code is called

$cordovaSQLite.execute(db, ‘delete from expenses where id = ?’, [itemIndex]);

I’ve put the query into a separate variable

var query = “delete from expenses where id = ?”;

and then ran it like so

$cordovaSQLite.execute(db, query, [itemIndex]);

still no luck, any advise

This works for me like a charm

    deleteRecord: function(id){
      var query = "DELETE FROM records WHERE id = '"+id+"'";
      $cordovaSQLite.execute(db, query, []).then(function(results) {
      }, function (err) {
1 Like

it’s working for me thanks