Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="status" name="status">Status Message</div>
- var db = openDatabase('mydb', '1.0', 'Test DB', 4 * 1024 * 1024);
- var msg;
- db.transaction(function (tx) {
- tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS (id unique, log Text,log1 Text)');
- tx.executeSql('INSERT INTO LOGS (id, log,log1) VALUES (1, "foobar","sa")');
- tx.executeSql('INSERT INTO LOGS (id, log,log1) VALUES (2, "logmsg","da")');
- msg = '<p>Log message created and row inserted.</p>';
- document.querySelector('#status').innerHTML = msg;
- });
- db.transaction(function (tx) {
- tx.executeSql('SELECT * FROM LOGS', [], function (tx, results) {
- var len = results.rows.length,
- i;
- msg = "<p>Found rows: " + len + "</p>";
- document.querySelector('#status').innerHTML += msg;
- for (i = 0; i < len; i++) {
- msg = "<p><b>" + results.rows.item(i).log + "</b></p>";
- document.querySelector('#status').innerHTML += msg;
- var book = results.rows.item(i);
- console.log(book);
- alert(book.log1);
- }
- }, null);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement