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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:30:10+00:00 2026-05-23T12:30:10+00:00

The idea: To create a countdown to show days or hours left until some

  • 0

The idea: To create a countdown to show days or hours left until some event (no minutes or seconds are required)…

I have MySQL database which stores data used by countdown: id, date & description.
I have a PHP file to get it all from database and output it into HTML

How it looks:

HTML Output:

<span>2 Days</span> Until Some Event!

PHP Code:

$result = mysql_query("SELECT * FROM countdowns ORDER BY id DESC",$connect);
while($myrow = mysql_fetch_assoc($result))
{
    echo "<div class=\"countdown\">";
        echo "<span>";
            echo $myrow['date'];
        echo "</span> ";
        echo $myrow['description'];
    echo "</div>";

So I want ‘span’ to dispaly days OR hours and rest will be description pulled from the database.

The problem: I want it to display ONLY days if hours are greater than 48 or ONLY hours if there are less than 48 hours left.

So it should look like:

5 Days Until Some Event! (There are more than 48 hours left)

OR

5 Hours Until Some Event! (There are obviously less than 48 hours left)

Why I need jQuery for this is because the page on which this countdown will be shown, will be active for days without reloading, so I need it to be dynamic…

I hope you can understand what I mean and probably could help me, thank you very much in advance!

Andrew Badger

  • 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-23T12:30:11+00:00Added an answer on May 23, 2026 at 12:30 pm

    Maybe you could use a plugin like timeago and change it so that instead of writing the time eladsed from a timestamp it shows the time missing to a timestamp.

    EDIT – maybe you don’t need to change any part of the code but just set this settings

    jQuery.timeago.settings.allowFuture = true;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have any idea what is wrong with this create statement for mysql?
In short, when you have planned or have thought about an idea to create
Working with Unity, I thought it would be a good idea to create some
can any body have idea for create dynamic class at run time.i have one
I have an idea to create a Parental Supervision Web Browser. The way it
I need some help with wordpress. The idea is create multioptional navigation in sidebar.
I recently had an idea to create my own String class to make using
Is it a good idea to create a lighter version of an Entity in
My idea is to create a .jar file that contains Services managed by Spring,
idea I would like to create a little app for myself to store ideas

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.