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"; Quote 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? Quote 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"; Quote 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? Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.