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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:52:42+00:00 2026-06-14T05:52:42+00:00

Using Phonegap with its SQL function, I get my query returns in the form

  • 0

Using Phonegap with its SQL function, I get my query returns in the form of

results.rows.item(i).Title

where results.rows.item(i) is per object and the .Title will specify which field to select.

This is only one of several fields, so instead of writing it out a massive line several times, I wanted to declare it as a variable.

var details = "results.rows.item(i).Title + \' \' " +
        "+ results.rows.item(i).Street + ' ' " +
        "+ results.rows.item(i).PostalCode + ' ' " +
        "+ results.rows.item(i).Contact + ' ' " +
        "+ results.rows.item(i).ContactEmail + ' ' " +
        "+ results.rows.item(i).ContactPhone + ' ' " +
        "+ results.rows.item(i).OperatingHours + ' ' " +
        "+ results.rows.item(i).Operator + '</p></div>'"

Of course the resulting problem is, its a string when I try to use in the following line

$("#locations").append('<div data-role="collapsible"><h3>' + results.rows.item(i).Title + '</h3><p>' + details);

What can I do?

Thanks.

  • 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-14T05:52:43+00:00Added an answer on June 14, 2026 at 5:52 am

    If I’m undestanding your question correctly, then you can use strings as property names by using bracketed notation rather than dot notation:

    var details = [];
    var item = results.rows.item(i);
    ["Title", "Street", "PostalCode", "Contact", "ContactEmail", "ContactPhone", "OperatingHours", "Operator"].forEach(function(field) {
        details[details.length] = item[field];
    });
    details = details.join(' ');
    

    (Note that that uses ES5’s forEach. If you may not be running in an ES5-enabled environment, you can use a shim [or rewrite the above to use a for loop].)

    Basically, in JavaScript, you have two options for accessing the property of an object: You can use a literal property name with a dot, e.g. foo.bar; or you can use bracketed notation with a string, e.g. foo["bar"]. In the latter case, the string doesn’t have to be a string literal, it can be the result of any expression. So all of these output the bar property of foo:

    var foo = {bar: "baz"};
    console.log(foo.bar);        // "baz"
    console.log(foo["bar"]);     // "baz"
    var s = "bar";
    console.log(foo[s]);         // "baz"
    var b = "b", a = "a", r = "r";
    console.log(foo[b + a + r]); // "baz"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an iOS app. Its working properly on simulator. I'm using phonegap and
I have developed android phonegap application using phonegap 1.9.0.Its was working fine in android
I'm using Phonegap 2.0 and try to get a media encoded as base64 from
I am using phonegap + jquery mobile and have a submit function that works
I m developing app using android-phonegap . its working fine when i call webservice
Is there a workaround or a phonegap plugin using which its possible to create
I'm trying to insert data into SQLite using Phonegap. Its working fine when hard
I am using Phonegap file upload to upload SVG files to my server. It's
I'm making a mobile app using phonegap. That is to say, it's all done
I'm using PhoneGap. And read it and created my work. http://docs.phonegap.com/en/1.9.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android And i added

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.