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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:30:45+00:00 2026-06-02T15:30:45+00:00

I defined the following Javascript function: function RecoverDataFromTable(table_name) { query = ; //some code

  • 0

I defined the following Javascript function:

function RecoverDataFromTable(table_name) {
              query = "";

              //some code that build a query string from table_name and
              //other arguments given to the function

              function Query(database) {
              database.executeSql(query, [], RecoverResults, Error)
              }

              function RecoverResults(database, results) {
              var my_result = results.rows(0).id;
              // assume this works and store a value to my_result
              }

              function Error(error) {
              //alert something
              }

              function Success() {
              //alert something
              }

              database.transaction(Query, Error, Success)                 

              }

Now, how can i return my_result value so i can do this?

var my_var = RecoverDataFromTable(table_name, argument1, argument2.....)

Thanks in advance.
Ask if you need more explanation. 🙂

http://www.raymondcamden.com/index.cfm/2012/1/6/Working-with-dates-and-SQLite-in-PhoneGap

  • 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-02T15:30:46+00:00Added an answer on June 2, 2026 at 3:30 pm

    You can’t really set the variable like that, because the function is asynchronous. Instead, you should include a callback function in your request to RecoverDataFromTable. Define it like this:

    function RecoverDataFromTable(callback, table_name) {
         ...
    
         function RecoverResults(database, results) {
              var my_result = results.rows(0).id;
              // assume this works and store a value to my_result
              // make the callback:
              callback(result);
         }
         ...
    }
    

    Then make the call like this:

    function handleResult(my_result)
    {
        // handle the result here
    }
    
    RecoverDataFromTable(handleResult, table_name, argument1, argument2.....);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting a function not defined Javascript error with the following code, which uses
Hi I have following JavaScript code that I am trying to run. My aim
I'm using the following code to load in content: <script type=text/javascript> jQuery.noConflict(); jQuery(document).ready(function(){ jQuery('.content-div').load(all-events.html);
I have Designed the Javascript function My.js it contains following code My.js function display(){
I have a JavaScript code coupon.js defined as follows - jQuery(document).ready(function(){ jQuery('.appnitro').submit( function() {
I have the following defined in a file called build-dependencies.xml <?xml version=1.0 encoding=UTF-8?> <project
I have defined the following ApplicationManifest file the problem is that i have created
I have some CCS defined as following: .FW_Buttons { -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius:
i load graphs via the following javascript function: function loadMCorCBGraph(self,surveyID,questionID,varID) { var img =
I am using nodejs. And calling something like the following from a javascript file:

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.