tqla Posted December 10, 2008 Share Posted December 10, 2008 Hello. Can someone tell me what is wrong with my coding. I don't get an error but the defaultmovie file always appears regardless of dates. I'm pretty sure my mistake is in the strtotime line but I don't know for sure. Thanks. <?php $startyear = "2008"; $startmonth = "12"; $startday = "08"; $finishyear = "2008"; $finishmonth = "12"; $finishday = "20"; $movie = "choppers.php"; $defaultmovie = "amnesia.php"; $start = strtotime($startyear - $startmonth - $startday); $finish = strtotime($finishyear - $finishmonth - $finishday); if(time() >= $start && time() < $finish){ include($movie); } else { include($defaultmovie); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/136291-solved-whats-wrong-with-my-coding/ Share on other sites More sharing options...
premiso Posted December 10, 2008 Share Posted December 10, 2008 $start = strtotime($startyear ."-". $startmonth ."-". $startday); $finish = strtotime($finishyear ."-". $finishmonth ."-". $finishday); You have to use concatenation properly. Quote Link to comment https://forums.phpfreaks.com/topic/136291-solved-whats-wrong-with-my-coding/#findComment-711012 Share on other sites More sharing options...
tqla Posted December 10, 2008 Author Share Posted December 10, 2008 Perfect! Thank you premiso! Quote Link to comment https://forums.phpfreaks.com/topic/136291-solved-whats-wrong-with-my-coding/#findComment-711017 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.