corillo181 Posted October 16, 2007 Share Posted October 16, 2007 hi! i got a mysql table with different dates. i would like to make a query that select everything between today and last week. i got the logic which is. $today = strtotime('now'); $lastweek = strt0time('-1 week'); $query ="select from product where unixtime_stamp(date)>='$lastweek' and unixtime_stamp(date)<$today"; Link to comment https://forums.phpfreaks.com/topic/73567-solved-mysql-query-select-last-week/ Share on other sites More sharing options...
corillo181 Posted October 17, 2007 Author Share Posted October 17, 2007 any guess anyone? Link to comment https://forums.phpfreaks.com/topic/73567-solved-mysql-query-select-last-week/#findComment-371182 Share on other sites More sharing options...
MadTechie Posted October 17, 2007 Share Posted October 17, 2007 try this $query ="select from product where unixtime_stamp(now())>='$lastweek' and unixtime_stamp(now())<$today"; Link to comment https://forums.phpfreaks.com/topic/73567-solved-mysql-query-select-last-week/#findComment-371186 Share on other sites More sharing options...
corillo181 Posted October 17, 2007 Author Share Posted October 17, 2007 i haven't tried that code but where dose it compare to the date field where i want to get the result from? Link to comment https://forums.phpfreaks.com/topic/73567-solved-mysql-query-select-last-week/#findComment-371189 Share on other sites More sharing options...
MadTechie Posted October 17, 2007 Share Posted October 17, 2007 i used NOW(), i guess you could add the () after the date on your version Link to comment https://forums.phpfreaks.com/topic/73567-solved-mysql-query-select-last-week/#findComment-371192 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.