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:
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