javascript - How can I insert a sessionStorage variable in an SQL db? -


i trying sessionstorage in db nothing gets inserted.

my code following:

window.onload = function (){                     doit.db = opendatabase('takenlijst v0.8', '1.0', 'takenlijst database', 2 * 1024 * 1024);               doit.db.transaction (function (tx) {                 tx.executesql('create table if not exists taak (id integer primary key , sid integer, taak, datum, conditie);');                  tx.executesql('create table if not exists segment (id integer primary key , naam);');                      });              document.getelementbyid("knopinvoeren").onclick = tinvoer;   };   var tinvoer = function (){                var datum = new date();             var taak = document.getelementbyid("taakinvoer").value;             var conditie = 0;             var sid = sessionstorage.smenuid;              doit.db.transaction(function (tx) {                       alert(""+ sessionstorage.smenuid +"");                  tx.executesql("insert taak ("+sessionstorage.smenuid+", taak, datum, conditie) values (?, ?, ?, ?);", [sid, taak, datum, conditie]);                   });              vulgegevens();             ophalen(sessionstorage.smenuid);         };  

when alert sessionstorage right value when try insert query, nothing happens.

does know doing wrong?

have tried using :

tx.executesql("insert taak (sid, taak, datum, conditie) values (?, ?, ?, ?);", [sid, taak, datum, conditie]);

i don't understand why you're trying provide evaluated value in definition part of sql query.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -