can someone help me with what I think is probably a simple problem please. I think the problem is probably with my SQL select statement, but maybe not.
I have a table named tableOne with two columns, name and total, the function editRecord is called and the id of the row in question is passed to it so I can select this row, then editRecords2 function is called. This second function generates a form in the html and adds the name and total values from the particular row in the table as into the form boxes.
The problem is that the values from the desired row never appear in the form, always the values from the last row go into the form. The code is below, any help would be great, thanks!
function editRecord(id) {
db.transaction(function(tx) {
tx.executeSql('SELECT * FROM tableOne WHERE id=?', [id], editRecords2);
});
}
function editRecords2() {
f = $('#edit');
f.html("");
f.html(f.html() + ' <form method="get" id="edit_form"><div><input type="name" id="editname" value="' + r['name']+'" size="30"/><input type="number" current id="editamount" value="' + r['total']+'" name="amount" size="15" /><input type="submit" value="Save" /></div></form> ');
}