graham23s Posted September 24, 2008 Share Posted September 24, 2008 Hi Guys, in this query i am trying to find the number of products (added by date) in the last 7 days! so if i upload 23 new products in the last 7 days the query selects all date/time stamps from the last 7 days! i have: <?php $q_p = "SELECT `date_added` FROM `fcp_products` WHERE `date_added` >= CURDATE();"; $r_p = mysql_query($q_p); $n_p = mysql_num_rows($r_p); ?> so far not sure how to do it though any help would be great cheers Graham Link to comment https://forums.phpfreaks.com/topic/125647-working-out-7-days/ Share on other sites More sharing options...
xtopolis Posted September 25, 2008 Share Posted September 25, 2008 I added a -7 ... and it worked on my simple test... $q_p = "SELECT `date_added` FROM `fcp_products` WHERE `date_added` >= CURDATE()-7"; Link to comment https://forums.phpfreaks.com/topic/125647-working-out-7-days/#findComment-650111 Share on other sites More sharing options...
fenway Posted September 29, 2008 Share Posted September 29, 2008 That's wrong... you want CURDATE() - INTERVAL 7 DAY Link to comment https://forums.phpfreaks.com/topic/125647-working-out-7-days/#findComment-653332 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.