Need help for save credential from mysql to sqlite localstorage

I am Newbie, can I get a sample script to login and save the username and password from mysql to sqlite local storage, thanks for the help

hi, this has nothing to do with f7.
but i will assume you are developing on mobile.
just add any plugin, eg:

storesafe/cordova-sqlite-storage: A Cordova/PhoneGap plugin to open and use sqlite databases on Android, iOS and Windows with HTML5/Web SQL API (github.com)

and read the doc;

var db = null;

document.addEventListener('deviceready', function() {
  db = window.sqlitePlugin.openDatabase({
    name: 'my.db',
    location: 'default',
  });
});
...
  db.transaction(function(tx) {
    tx.executeSql('CREATE TABLE IF NOT EXISTS NotSecureTable (user, pass)');
    tx.executeSql('INSERT INTO NotSecureTable VALUES (?,?)', ['Alice', 1234]);
    tx.executeSql('INSERT INTO NotSecureTable VALUES (?,?)', ['Betty', 4321]);
  }, function(error) {
    console.log('Transaction ERROR: ' + error.message);
  }, function() {
    console.log('Populated database OK');
  });
2 Likes