Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't get values from Sqlite DB using query
    primarykey
    data
    text
    <p>I used sqlite to populate a DB with some Tables in it. I made a function at another javascript page that executes the database &amp; selects some values from the table. The function is called at $(document).ready(). </p> <p>Javascript: </p> <pre><code> //DB Population function onDeviceReady() { var db = window.openDatabase("Database", "1.0", "SqliteTrial", 20000); db.transaction(populateDB, errorCB, successCB); } function populateDB(tx) { tx.executeSql('DROP TABLE IF EXISTS Subjects'); tx.executeSql('CREATE TABLE IF NOT EXISTS Subjects (id unique, subjectname)'); tx.executeSql('INSERT INTO Subjects (id, subjectname) VALUES (1, "Math")'); tx.executeSql('INSERT INTO Subjects (id, subjectname) VALUES (2, "Science")'); } function GetSubjectsFromDB() { console.log(""); tx.executeSql('SELECT * FROM Subjects', [], queryNSuccess, errorCB); } function queryNSuccess(tx, results) { alert("Query Success"); console.log("Returned rows = " + results.rows.length); if (!results.rowsAffected) { console.log('No rows affected!'); return false; } console.log("Last inserted row ID = " + results.insertId); } function errorCB(err) { alert("Error processing SQL: "+err.code); } </code></pre> <p>Is there some problem with this line? </p> <pre><code>tx.executeSql('SELECT * FROM Subjects', [], queryNSuccess, errorCB); </code></pre> <p>The queryNSuccess isn't called, neither is the errorCB so I don't know what's wrong. </p> <p>This is how I call it at another page: </p> <p>Javascript: </p> <pre><code> $(document).ready(function () { DisplayData(); GetSubjectsFromDB(tx); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload