Inserting A Variable Into SQL Table
I cannot seem to get user entered data into a table and then printed. Here is my code thus far:
Solution 1:
I think you just need to change the way you're getting and inserting your values (also, you had a syntax error in the SQL on this line):
var input = document.getElementById('someId').value;
...
tx.executeSql('INSERT INTO LOGS (id, log) VALUES (1, ?)', [input]);
...
I think you can forget about the localStorage
variable altogether, unless you need to persist those values.
Solution 2:
To insert multiple variables into the table, use the following format.
tx.executeSql('INSERT INTO CacheRequest (key,value) VALUES (?,?)',[variableKey,variableValue]);
Post a Comment for "Inserting A Variable Into SQL Table"