jakebur01 Posted August 8, 2008 Share Posted August 8, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/118773-solved-countdown/ Share on other sites More sharing options...
alin19 Posted August 8, 2008 Share Posted August 8, 2008 i think that you need a javascript Quote Link to comment https://forums.phpfreaks.com/topic/118773-solved-countdown/#findComment-611525 Share on other sites More sharing options...
JD* Posted August 8, 2008 Share Posted August 8, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/118773-solved-countdown/#findComment-611553 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.