I'm a new Cordova-Android program maker. I've successfully create and insert the local database fields. But I stuck when I want to display them into input tag.
This is my table :
+----+------+---------+
| id | word | stats |
+----+------+---------+
| 1 | abc | stackov |
| 2 | def | erflow |
+----+------+---------+
I try this code
$(document).ready(function(){
docDB = window.openDatabase("Test", "1.0", "Test Data", 50000);
docDB.transaction(function (tx) {
tx.executeSql("SELECT * FROM Test WHERE word='abc'", [], function (tx, results) {
var dblen = results.rows.length;
if( dblen>0 ){
document.getElementById("abc").value = results.rows.item(0)['stats'];
}
}, null);
});
});
I've searching for simplest way, because I just want to display single SQL column value word='abc' and other word value such word='def'. Can someone correct it?
And I would insert the result value into a input field
Name : <input type="text" id="abc">
Thanks for answering :)