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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:50:51+00:00 2026-05-22T17:50:51+00:00

I am currently using phonegap and trying to display results from a sqlite table

  • 0

I am currently using phonegap and trying to display results from a sqlite table to a html table through javascript. What should I do to make this possible?

    // callback function to retrieve the data from the prefs table
celebsDataHandler=function(transaction, results) {
  // Handle the results 
  var html = "<ul>"; 
  for (var i=0; i<results.rows.length; i++) { 
    var row = results.rows.item(i); 
    html += '<li>'+row['name']+'</li>\n';
  } 
  html +='</ul>';
  alert(html);
}


// load the currently selected icons
loadCelebs = function() {
  try {

    mydb.transaction(
        function(transaction) {
           transaction.executeSql('SELECT * FROM celebs ORDER BY name',[], celebsDataHandler, errorHandler);
        });

  } catch(e) {
    alert(e.message);
  }

}

From http://wiki.phonegap.com/w/page/16494756/Adding-SQL-Database-support-to-your-iPhone-App

so the resultant is celebsDataHandler. How can I manipulate the data stored inside to display in html table(probably using a for loop or ..?)?

  • 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-05-22T17:50:51+00:00Added an answer on May 22, 2026 at 5:50 pm

    Okay, then try to use this function:

    c3.table = function(data,target,className){
        if(typeof target != 'object'){
        return(null);
        }
        var table = document.createElement('table');
        if(typeof className != 'undefined'){
            table.setAttribute('className', className);
        }
        target.appendChild(table);
            var thead = document.createElement('thead');
            var tr = document.createElement('tr');
            thead.appendChild(tr)
            table.appendChild(thead);
            for (key in data[0]){
            if (data[0].hasOwnProperty(key)) {
                var th = document.createElement('th');
                th.innerHTML = key;
                tr.appendChild(th);
            }
            }
            for (row in data){
            var tbody = document.createElement('tbody');
            var tr = document.createElement('tr');
            tbody.appendChild(tr)
            table.appendChild(tbody);
            var currentRow = data[row];
            for (column in currentRow){
                if (currentRow.hasOwnProperty(column)){
                var td = document.createElement('td');
                td.column = column;
                td.innerHTML = currentRow[column];
                tr.appendChild(td);
                }
            }
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to submit an xhr using phonegap on the blackberry. Currently when
Currently I've been using google's static maps to display maps in a phonegap app
Currently using Oracle/BEA/Plumtree ALUI Portal 6.1, and am trying to display a client's IP
I'm currently using DPack as this adds a Collapse All Projects option to the
currently using PHP5 with htmlMimeMail 5 ( http://www.phpguru.org/static/mime.mail.html ) to send HTML e-mail communications.
Currently using: @^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?$ How can i make http:// not compulsory but if it does
Currently using System.Web.UI.WebControls.FileUpload wrapped in our own control. We have licenses for Telerik. I
Im currently using vs2008 with asp.net mvc framework for web development. Im missing a
I'm currently using VS2005 Profesional and .NET 2.0, and since our project is rather
I am currently using Windows Server 2008 Standard and have several Hyper V machines.

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.