techker Posted February 25, 2009 Share Posted February 25, 2009 hey guys im made a scanning system that when the member scans his id card it gets info from the databse nam and if there is a message in his file. i want to add an alert like there is x day's left to the end of your contract.. i have in the databse the created date and the end date. how can i calculate the remeinder of days ? Quote Link to comment https://forums.phpfreaks.com/topic/146841-countdown-from-time-in-database/ Share on other sites More sharing options...
techker Posted February 25, 2009 Author Share Posted February 25, 2009 i found this but i can't seem to modify it for me? function countdown($event,$month,$day,$year) { // subtract desired date from current date and give an answer in terms of days $remain = ceil((mktime(0,0,0,$month,$day,$year) - time()) / 86400); // show the number of days left if ($remain > 0) { print "<p><strong>$remain</strong> more sleeps until $event</p>"; } // if the event has arrived, say so! else { print "<p>$event has arrived!</p>"; } } // call the function countdown("Christmas Day", 12, 25, 2008); Quote Link to comment https://forums.phpfreaks.com/topic/146841-countdown-from-time-in-database/#findComment-770906 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.