Jump to content

How to fetch sqlite data on another page


Recommended Posts

Hii,

 

For local sqlite storage i am following this tutorial -

https://tejasrpatel.wordpress.com/2011/12/29/create-sqlite-off-line-database-and-insertupdatedeletedrop-operations-in-sqlite-using-jquery-html5-inputs/

 

I am using these commands to create a table in my login.html page -

var createStatement = "CREATE TABLE IF NOT EXISTS userdetails (username TEXT, password TEXT, company TEXT)";
var db = openDatabase("QuickTask", "1.0", "Quick Task", 200000);  // Open SQLite Database
                    
                    
                    
function initDatabase()  // Function Call When Page is ready.
{
    try {
        if (!window.openDatabase)  // Check browser is supported SQLite or not.
        {
            alert('Databases are not supported in this browser.');
        }
        else {
            createTable();  // If supported then call Function for create table in SQLite
        }
    }
    catch (e) {
        if (e == 2) {
            // Version number mismatch. 
            console.log("Invalid database version.");
        } else {
            console.log("Unknown error " + e + ".");
        }
        return;
    }
}
                    
                    
  function createTable()  // Function for Create Table in SQLite.
{
    db.transaction(function (tx) { tx.executeSql(createStatement, [], showRecords, onError); });
}                  
    

After succesful login i am directing to welcome.html 

window.location.href = "welcome.html";

How do i access my tables on this page ? In console i am not finding any tables. I am trying to make an app [will make apk using phonegap] and stuck at the very beginning..Please help / Guide

Edited by ersaurabh101
Link to post
Share on other sites
This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.