Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9113451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:58:03+00:00 2026-06-17T03:58:03+00:00

I have the following code for my sqlite to store a name and image

  • 0

I have the following code for my sqlite to store a name and image from camera. I know from the Eclipse console that I am getting the name and image path. The console.log(addRecord) is getting the name and image path but I am getting a “cannot executeSql of undefined” message on the transaction line and on the queryDB function so I think I am making a mistake with my insert statement? Also, is the datatype text correct for imageURI?. Any help appreciated.

   function onDeviceReady() {
    var db = window.openDatabase("database", "1.0", "Profiles", 5000);
    if(db) {
console.log('The device is ready');
db.transaction(populateDB, errorCB, successCB, insertRecord); // only do stuff if db exists
}
else{
console.log('There is a problem');
}   
   function populateDB(tx) {
   tx.executeSql('DROP TABLE IF EXISTS USERS');//get rid of this once working?
   tx.executeSql('CREATE TABLE IF NOT EXISTS USERS (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, username VARCHAR NOT NULL, imagePath TEXT)');
   console.log('The table USERS is created');
   }
  //Insert the details
function insertRecord(tx) {
       userName = document.getElementById('userName').value;
       imagePath;
       var addRecord = 'INSERT INTO USERS (username, imagePath) VALUES ("' + userName + '","' + imagePath + '")';
       console.log(addRecord);
       tx.executeSql(addRecord, [userName, imagePath], queryDB, errorCB);
}

 // Query the database
function queryDB(tx) {
       var getUsers = "SELECT * FROM USERS ORDER BY id ASC', [], querySuccess, errorCB";
       db.transaction(function (tx) {
       tx.executeSql(getUsers, [], querySuccess, queryFailure);
    }, errorCB, successCB);
}

// Query the success callback

function querySuccess(tx, results) {
        console.log("You are in the querysuccess function");
}

// Transaction error callback

function errorCB(err) {
        console.log("Error processing SQL: " + err.code);
}

function queryFailure(err) {
      console.log("Error processing SQL: " + err.code);
}
// Transaction success callback

function successCB() {
      console.log('The db and table are working');
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T03:58:04+00:00Added an answer on June 17, 2026 at 3:58 am

    The identifier queryFailure is undefined. Add the function:

    function queryFailure(tx, results) {
        console.log("You are in the queryFailure function");
    }
    

    Once you get it running, you will see that the queryFailure function is called, because you have an error in the query. This:

    var getUsers = "SELECT * FROM USERS ORDER BY id ASC', [], querySuccess, errorCB";
    

    should be:

    var getUsers = "SELECT * FROM USERS ORDER BY id ASC";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code for loading image from url in xml parsing endElement method
See this question . I have the following code that executes against a SQLIte
i have following code in which, i am fetching the data from the sqlite
I have following code that I am compiling in a .NET 4.0 project namespace
I am using the following tcl code to store a file from my deskstop
If I have the following code: import sqlite sqlite.connect('tmp.db').cursor().close() I get the following error
I have the following code that creates my table. I insert data into it
I have a file.db (binary) that I can read from SQlite 3.exe, but I
I have following code working on a development environment (SQLite) but generating an error
I have following code (modified code from this tutorial ): -(NSMutableArray *) getChampionDatabase {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.