SQLite help

Hi,

I need some help with SQLite. I have got an intro, when I start the app, it’s working. I would like to store the state (the user already saw it) in sqlite, but I always get error. Does anybody can help with it?

.run($ionicPlatform, $location, $cordovaSplashscreen, $cordovaStatusbar, $cordovaSQLite, $state) {
     $ionicPlatform.ready(function() {               
         db = $cordovaSQLite.openDB("app.db");
         $cordovaSQLite.execute(db, "CREATE TABLE IF NOT EXISTS Settings (id INTEGER PRIMARY KEY AUTOINCREMENT, touchState INTEGER, tutorialState INTEGER)");
     });
         
     setTimeout(function() {
        $cordovaSplashscreen.hide();
        $state.go('intro');
     }, 5000);
}

.controller('IntroCtrl', ['$scope', '$state', '$ionicPlatform', '$cordovaSQLite', function($scope, $state, $ionicPlatform, $cordovaSQLite) {
                    
    var startApp = function() {
        $ionicPlatform.ready(function() {
            var state = 1;
            $cordovaSQLite.execute(db, 'INSERT INTO Settings (tutorialState) VALUES (1)')
            .then(function(result) {
                alert('saved');
            }, function(error) {
                alert('error');
            })
        });
        $state.go('signin');
    };
            
    $scope.next = function() {
        $scope.$broadcast('slideBox.nextSlide');
    };
            
    var rightButtons = [{
        content: 'Next',
        type: 'button-light button-clear',
        tap: function(e) {
            $scope.next();
        }
    }];
        
    var leftButtons = [{
        content: 'Skip',
        type: 'button-light button-clear',
        tap: function(e) {
            startApp();
        }
    }];

    $scope.leftButtons = leftButtons;
    $scope.rightButtons = rightButtons;
            
            
    $scope.slideChanged = function(index) {
        if(index > 0) {
            $scope.leftButtons = [{
                content: 'Back',
                type: 'button-light button-clear',
                tap: function(e) {
                    $scope.$broadcast('slideBox.prevSlide');
                }
            }];
        } else {
            $scope.leftButtons = leftButtons;
        }
            
        if(index == 2) {
            $scope.rightButtons = [{
                content: 'Start App',
                type: 'button-light button-clear',
                tap: function(e) {
                    startApp();
                }
            }];
        } else {
            $scope.rightButtons = rightButtons;
        }
    };
}])