HTML read values from web sql database html5 - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution
join us

How to read the values from the web sql database using html5 ?


 85

HTML


0

Database name
Version number
Text description
Size of database
Creation callback


<script>

var db = openDatabase('namedb', '1.0', 'my database', 2 * 1024 * 1024);

db.transaction(function (tx) {
tx.executeSql('SELECT * FROM tablename', [], function (tx, results) {
var char = results.rows.length, i;
msg1 = "<p>record: " + char + "</p>";
document.querySelector('#status').innerHTML += msg1;

for (i = 0; i < char; i++){
msg1 = "<p><b>" + results.rows.item(i).log + "</b></p>";
document.querySelector('#test').innerHTML += msg1;
}
}, null);
});

</script> 


By        
The power of the user (%)
80%

HTML


0

<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://code.jquery.com/jquery-2.1.3.min.js" type="text/javascript"></script>
</head>
<body>

<script>

$(document).ready(function () {

//works in chrome, safari, opera

var db=null;
db = window.openDatabase("MyDb", "1.0", "my database", 1024*1024*3);

db.transaction(function(tx){

tx.executeSql("SELECT id, country, city FROM MYTABLE", [],
function(SQLTransaction, data){

for(var i=0; i < data.rows.length;i++) {

var row = data.rows.item(i);

$("#id").text(row["id"]);
$("#country").text(row["country"]);
$("#city").text(row["city"]);

}

});

});

});

</script>

<div id="id"></div></br>
<div id="country"></div></br>
<div id="city"></div></br>
<div id="output"></div>

</body>
</html>


By        
The power of the user (%)
62%



The most helpful HTML solutions

how to create the moving picture left and right in html ?how to create the moving picture left and right in html ?HTML

Click to see more ...

  1.2K     97

How to create 3D cube with shadow using html, css ?How to create 3D cube with shadow using html, css ?HTML

Click to see more ...

  919     94

how to create the moving picture up and down in html ?how to create the moving picture up and down in html ?HTML

Click to see more ...

  860     83

Who we can create sub domain in HTML in our site ?Who we can create sub domain in HTML in our site ?HTML

Click to see more ...

  588     61

How to trigger video in html ?How to trigger video in html ?HTML

Click to see more ...

  278     38

How to create 3D cylinder using html, css, jquery ?How to create 3D cylinder using html, css, jquery ?HTML

Click to see more ...

  779     27

How to create the rolling and rotating cube with stop and start button in html, css, jquery ?How to create the rolling and rotating cube with stop and start button in html, css, jquery ?HTML

Click to see more ...

  565     24

redirect to another page submit using htmlredirect to another page submit using htmlHTML

Click to see more ...

  348     19

How set a navigation in footer using html  ?How set a navigation in footer using html ?HTML

Click to see more ...

  325     18

how to create a moving picture using html ?how to create a moving picture using html ?HTML

Click to see more ...

  282     15

Welcome aboard!
We are happy you are here and
wish you good net-raft!