wmguk Posted February 23, 2009 Share Posted February 23, 2009 Hey guys, I have a simple script to display any registrations since 5pm yesterday, however it only shows registrations since midnight... $from_date = date('Y-m-d',strtotime('now 0 days 5pm')); $to_date = date('Y-m-d',strtotime('now +1 days')); $qryto = "BETWEEN '{$from_date}' AND '$to_date'"; WHERE reg_date $qryto AND active='1' Any ideas why this isnt working? Link to comment https://forums.phpfreaks.com/topic/146490-solved-simple-show-all-registrations-between-459pm-yesterday-and-now/ Share on other sites More sharing options...
wrathican Posted February 23, 2009 Share Posted February 23, 2009 $time = date("Y-m-d H:i:s", strtotime("5pm -1 day"); select * from table where reg_date > $time Link to comment https://forums.phpfreaks.com/topic/146490-solved-simple-show-all-registrations-between-459pm-yesterday-and-now/#findComment-769026 Share on other sites More sharing options...
wmguk Posted February 23, 2009 Author Share Posted February 23, 2009 Hi, Thanks for that, I've tried it but it doesnt work, my DB has the reg_date displaying as 2009-02-19 15:22:10 and if i echo $time I get 2009-02-20 17:00:00 (I changed it to -3 days so that it will display several records (currently 3 registrations since 20th after 5pm, but still shows none.... could it be the qry? if i echo the qry string i get SELECT * FROM candidateinfo WHERE reg_date > 2009-02-20 17:00:00 AND active='1' ORDER BY reg_date DESC Link to comment https://forums.phpfreaks.com/topic/146490-solved-simple-show-all-registrations-between-459pm-yesterday-and-now/#findComment-769031 Share on other sites More sharing options...
wrathican Posted February 23, 2009 Share Posted February 23, 2009 remove the AND active and the order clause and see what you get then. Link to comment https://forums.phpfreaks.com/topic/146490-solved-simple-show-all-registrations-between-459pm-yesterday-and-now/#findComment-769046 Share on other sites More sharing options...
wmguk Posted February 23, 2009 Author Share Posted February 23, 2009 ah ha, nope it was ' ' I needed to put WHERE reg_date > '$time' AND active='1' but thats excellent thank you, its all working now! Link to comment https://forums.phpfreaks.com/topic/146490-solved-simple-show-all-registrations-between-459pm-yesterday-and-now/#findComment-769049 Share on other sites More sharing options...
wrathican Posted February 23, 2009 Share Posted February 23, 2009 no problem, glad i could help Link to comment https://forums.phpfreaks.com/topic/146490-solved-simple-show-all-registrations-between-459pm-yesterday-and-now/#findComment-769051 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.