beachdaze Posted January 9, 2008 Share Posted January 9, 2008 In a live call log, we have three areas, verified for today, un-verified for today and un-verified older. I need the older to only show the last 3 days of entries. This is a sample of the code; $query_SearchAllUnverified = "SELECT * FROM dish WHERE date!=('$currentdate') AND status='UN-VERIFIED'"; Which returns all past date entires. I have tried using the now() function; $query_SearchAllUnverified = "SELECT * FROM dish WHERE date=(NOW() - INTERVAL 3 DAY) AND status='UN-VERIFIED'"; Which returns a blank document. I have placed every variation of single quotes I can think of in the bottom sample, but nothing returns data. Any advice please? Link to comment https://forums.phpfreaks.com/topic/85230-solved-return-a-date-range-now-interval/ Share on other sites More sharing options...
GingerRobot Posted January 9, 2008 Share Posted January 9, 2008 You need to be selecting where the date is greater than or equal to 3 days ago: $query_SearchAllUnverified = "SELECT * FROM dish WHERE date>=(NOW() - INTERVAL 3 DAY) AND status='UN-VERIFIED'"; Link to comment https://forums.phpfreaks.com/topic/85230-solved-return-a-date-range-now-interval/#findComment-434809 Share on other sites More sharing options...
beachdaze Posted January 9, 2008 Author Share Posted January 9, 2008 Nice thought, I should have seen that. Sometimes I'm an idiot! Many Thanks! Link to comment https://forums.phpfreaks.com/topic/85230-solved-return-a-date-range-now-interval/#findComment-434821 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.