thecard Posted June 6, 2008 Share Posted June 6, 2008 Whats the best way to make a countdown timer in php to: Countdown from 10 seconds and then do a mysql query? Quote Link to comment https://forums.phpfreaks.com/topic/109045-countdown-then-mysql-query-help/ Share on other sites More sharing options...
ILYAS415 Posted June 6, 2008 Share Posted June 6, 2008 There is no best way... well you cant actually create a countdown timer with php i think. You can use cron jobs. Or you can use javascript. I would actually recommend javascript... something like... setInterval("func()", 10000); //run javascript func() function every 10 seconds Quote Link to comment https://forums.phpfreaks.com/topic/109045-countdown-then-mysql-query-help/#findComment-559426 Share on other sites More sharing options...
discomatt Posted June 6, 2008 Share Posted June 6, 2008 Javascript is your best bet. When the java timer reaches 0, call a php page in an invisible iframe that executes the desired query. Quote Link to comment https://forums.phpfreaks.com/topic/109045-countdown-then-mysql-query-help/#findComment-559452 Share on other sites More sharing options...
thecard Posted June 6, 2008 Author Share Posted June 6, 2008 Thanks but please can you explain or write the code on how I would do that. Sorry, I'm ok at php, but not very experienced by any means! Quote Link to comment https://forums.phpfreaks.com/topic/109045-countdown-then-mysql-query-help/#findComment-559459 Share on other sites More sharing options...
discomatt Posted June 6, 2008 Share Posted June 6, 2008 I won't code for you, but I will help direct you. Here's a GREAT article on IFRAMEs and JavaScript http://www.devarticles.com/c/a/JavaScript/Working-with-IFRAME-in-JavaScript/ Simple javascript timer http://java-scripts.net/javascripts/Countdown-Timer.phtml The reason I'm showing you these is because if someone codes this for you, you won't learn anything If you don't learn anything, you'll be back here asking for help with no idea what your code does. This frustrates most of us, and it may take a long time to get things fixed. Learn it yourself, and you know exactly what is breaking when it does. Quote Link to comment https://forums.phpfreaks.com/topic/109045-countdown-then-mysql-query-help/#findComment-559462 Share on other sites More sharing options...
thecard Posted June 6, 2008 Author Share Posted June 6, 2008 Yeah, great. I agree! Quote Link to comment https://forums.phpfreaks.com/topic/109045-countdown-then-mysql-query-help/#findComment-559467 Share on other sites More sharing options...
jonsjava Posted June 6, 2008 Share Posted June 6, 2008 If you don't need a visual, it's doable in PHP: <?php sleep(10); ?> Quote Link to comment https://forums.phpfreaks.com/topic/109045-countdown-then-mysql-query-help/#findComment-559471 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.