Jump to content

[SOLVED] countdown


jakebur01

Recommended Posts

 

 

I have a chat that I need displayed between certain times. I have a datetime column in my mysql data base that marks the start time and end time.

 

How can I display the countdown to the chat, then display the chat code when it's time, then display a message when the chat has ended.

 

 

Link to comment
Share on other sites

Alin19 is somewhat correct. It sounds like you need to do a couple of things:

 

When the page loads, check the database to against the current time. If it's chat time, skip the rest and load the chat. If it's not time, call out a javascript function that will do the countdown and pass the time left to it via some subtraction (chat time - now).

 

In the javascript counter you'll need to place some code that will have an ajax-like functionality so that when the time is up, it will automatically load the chat for people sitting on the page.

 

In your chat script, when the chat is over, also have an ajax-like function that will either reload the page for everyone (thus doing the above check and starting the timer again) or have it close down the part of the page that the chat is on and then query the db again to start the counter.

 

Let me know if you need more explanation on any part.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.