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 8196491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:29:44+00:00 2026-06-07T05:29:44+00:00

I am working on a camera app using the PhoneGap. The thing I am

  • 0

I am working on a camera app using the PhoneGap.

The thing I am trying to accomplish is, that when my app takes a picture and I store the picture in the app directory, I want to insert an entry in the database also with the name of the file, path and uploaded flag entry.

I am having trouble doing this. And I am unsure where the problem is occurring.

The code used to create database and the Table and then insert the entry is shown below. I call the “insertInTable” function after the file is already saved in the app directory.

 function insertInTable(name, path)
{
    var db = window.openDatabase('taukydb', '1.0', 'Tauky Database', 200000);
    db.transaction(populateDB, errorCB, successCB);
    //db.transaction(successCB, errorCB, );

    //return();
}

function populateDB(tx) {
    tx.executeSql('CREATE TABLE IF NOT EXISTS taukytb (name UNIQUE, path, uploaded)');
    tx.executeSql('INSERT INTO taukytb (name, path, uploaded) VALUES (filename, filepath, 0)');

}

// Transaction success callback
function successCB() {
    alert("Hurrey!!!");

    //this is just for testing
    var db = window.openDatabase("Database", "1.0", "Cordova Demo", 200000);
    db.transaction(queryDB, errorCB);               
}

function queryDB(tx) {
    tx.executeSql('SELECT * FROM taukytb', [], querySuccess, errorCB);
}


function querySuccess(tx, results) {
    var len = results.rows.length;
    alert(len);
}

// Transaction error callback
function errorCB1(err) {            
    alert("Error 11111 processing SQL: "+err.code);
    //console.log("Error processing SQL: "+err.code);

}

// Transaction error callback
function errorCB(err) {         
    alert("Error processing SQL: "+err.code);
    //console.log("Error processing SQL: "+err.code);

}

When I run this code, the function “succesCB” never gets called, neither the errorCB is called.

Please have a look at this. I am new to mobile development and I have been stuck on this since sometime now.

Thanking in advance

  • 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-07T05:29:47+00:00Added an answer on June 7, 2026 at 5:29 am

    I have made few changes to make it work.

    tx.executeSql('INSERT INTO taukytb (name, path, uploaded) VALUES ("'+filename+'", "'+filepath+'", 0)');
    

    This change will call the successCB as the query executes fine.

    function successCB() {
        alert("Hurrey!!!");
    
        //this is just for testing
        var db = window.openDatabase("Database", "1.0", "Cordova Demo", 200000);
        db.transaction(queryDB, errorCB);               
    }
    
    function queryDB(tx) {
        tx.executeSql('SELECT * FROM taukytb', [], querySuccess, errorCB);
    }
    

    This method however will not work as you expect as you are creating second database providing the transaction of that but then querying for the table of first database.

    Below is the full source example which creates two database with same table in both

    https://gist.github.com/3058562

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a security camera application using the webcam that takes a photo
I am working on an app that uses the camera to take a picture
I've been trying to get the camera section on my app working for about
I have been working on an app which includes using the devices camera. After
I am working on an app that accesses the camera and returns an uri,
In my PhoneGap/jQuery Mobile app, I'm currently using PhoneGaps' Camera API to allow the
Im building an app that takes a photo of the user, its working fine
I'm working on an app, that's using an AVCaptureSession , to show the live
I'm working on a universal app that uses the camera on iOS devices and
I am working on an app that will show reverse view from camera. For

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.