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

  • Home
  • SEARCH
  • 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 5844203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:15:34+00:00 2026-05-22T12:15:34+00:00

I am building a local database with this : var db = openDatabase(‘LIST’,’1.0′,’database’, 2*1024*1024);

  • 0

I am building a local database with this :

var db = openDatabase('LIST','1.0','database', 2*1024*1024);

db.transaction(function (tx) {
  tx.executeSql('CREATE TABLE IF NOT EXISTS entry (ID INTEGER PRIMARY KEY ASC, first TEXT, last TEXT, email TEXT, phone TEXT, contest TEXT, added_on DATETIME)');
});

db.transaction(function(tx){
  tx.executeSql('INSERT INTO entry (first, last, email, phone, contest, added_on) VALUES (?,?,?,?,?,?)',
  [vFirst, vLast, vEmail, vPhone, vContest, addedOn]);
});

How would I populate a div with count of total rows in the database? I guess I would use something like SELECT COUNT(*) FROM entry .. but I am unclear on how to write this or print the output on the page.

If I was using local storage I see I could do something as simple as var length = window.localStorage.length; but I can not figure out how to do something similar with SQL.

  • 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-22T12:15:34+00:00Added an answer on May 22, 2026 at 12:15 pm

    If you want to count all rows from entry table, then SELECT COUNT(*) FROM entry
    If you want to know count of rows in database, then UNION queries from different tables and sum using SUM()

    EDIT:

    db.transaction(function(tx) {
       tx.executeSql("SELECT COUNT(*) FROM entry", [],
          function(tx, result) {
             //console.log(result.rows);
             console.log(result.rows.item(0)["count(*)"]);
    
             // do the html stuff to push this value to div
          },
          function(tx, error){
             // error occured
          }
       );
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm trying to connect to a database building a class connection()saved in local folder
I'm building a system that updates its local database from other APIs frequently. I
I am building my own local search UI element that gives local search suggestions
I am building an internet site, using my local machine as the development box
I'm building a basic CRUD library, that I anticipate use in both local (add
I'm currently building an Azure Web Role. I am testing this project against a
I am building an application that will function as a client-server application, and also
I'm building a local vm for doing web dev rather than using our on
I'm working with another dev and together we're building out a MySQL database. We've
A customer need a document managment system and I'm building information about this. I

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.