JSFiddle - React, Tailwind, and code Playground

by Amar Nyayapati

JavaScript

var db = openDatabase('mydb', '1.0', 'Test DB', 2 * 1024 * 1024);
db.transaction(function (tx) {  
   tx.executeSql('CREATE TABLE IF NOT EXISTS mytable1 (id unique, log)');
   tx.executeSql('INSERT INTO mytable1 (id, log) VALUES (1, "amar")');
   tx.executeSql('INSERT INTO mytable1 (id, log) VALUES (2, "nagendra")');
   tx.executeSql('INSERT INTO mytable1 (id, log) VALUES (3, "ranganadh")');
   tx.executeSql('INSERT INTO mytable1 (id, log) VALUES (4, "anupam")');
    alert("details entered successfully")
});
db.transaction(function (tx) {  
   tx.executeSql('SELECT * FROM mytable1', [], function (tx, results){
       var len = results.rows.length;
       for (i = 0; i < len; i++){
            alert(results.rows.item(i).log );
       }
    }, null);
});