2
I’m trying to make a select
from a ID
who will be caught in the value
of a option
, I did a search on the net and saw that they put this inside a function, but when I put the function, the variable that should store the value, it just doesn’t work anymore.
That way the code works and even gets the value, but it does not work in the select
from DB, everything I’ve tried to do always fails to work.
var myTest = document.getElementById("list").value;
db.transaction(function(tx) {
tx.executeSql(
'SELECT * FROM exercicios WHERE se_id = ?', [myTest],
function(tx, results){
var exlist = document.getElementById("exlist");
for(var i = 0; i < results.rows.length; i++) {
var row = results.rows.item(i);
exlist.innerHTML += "<li>" + row.se_id + " - " + row.ex_nome + "</li>";
}
}
);
});
My friend, beware of input codes mixed with sql queries and html outputs... it’s time to search for an architecture. These code that "even work" one hour will give you a lot of headache.
– Marcelo Aymone