vendredi 27 mars 2015

display data from sqlite database in html form(phonegap)

I have one html form in which all the fields have to filled from the data in my database. I tried using a javascript file and created one document.getElementbyID but it didnt worked.



<script type="text/javascript">
getMultipleRows();
function getMultipleRows()
{
var db = window.sqlitePlugin.openDatabase({name: "drrem.db", location: 1});
db.transaction
(
function (tx)
{
tx.executeSql
(
'SELECT medicine_name FROM Medicine',
[],
function(tx,results)
{
var len = results.rows.length;
if(len>0)
{
for (var i = 0; i < len; i++)
{
var a;

a[i]=results.rows.item(i)['medicine_name'];
document.getElementById("output").value=a[i];
}
}
}
);
}
);
}
</script>

Here is the html code in which I want the data to be displayed :

<input type="text" name="MedicineName" id="output"/>

Aucun commentaire:

Enregistrer un commentaire