bsamson Posted May 13, 2008 Share Posted May 13, 2008 Alright I currently have this code: <?php mysql_query("SELECT * FROM v2callbacks WHERE DATE_FORMAT(FROM_UNIXTIME(`entrydate`), '%Y/%m/%d') = '2008/05/13'") ?> How do I change this section: DATE_FORMAT(FROM_UNIXTIME(`entrydate`), '%Y/%m/%d') to add 15 days to the entrydate field? Not change the field BUT take the entrydate and add 15 days. Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/105446-solved-mysql-query-searching-for-future-date/ Share on other sites More sharing options...
bsamson Posted May 13, 2008 Author Share Posted May 13, 2008 hmmm ... when I run the following query ... it doesn't appear to error out. Any pros and/or cons? <?php mysql_query("SELECT * from v2callbacks WHERE DATE_ADD(DATE_FORMAT(FROM_UNIXTIME(`entrydate`), '%Y/%m/%d'), INTERVAL 15 DAY) = '2008/05/13'"); ?> Thanks again... Link to comment https://forums.phpfreaks.com/topic/105446-solved-mysql-query-searching-for-future-date/#findComment-540080 Share on other sites More sharing options...
BlueSkyIS Posted May 13, 2008 Share Posted May 13, 2008 looks good at first glance. but you might not see errors unless you mysql_query() or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/105446-solved-mysql-query-searching-for-future-date/#findComment-540082 Share on other sites More sharing options...
bsamson Posted May 13, 2008 Author Share Posted May 13, 2008 Thanks for the input. But it doesn't appear to be working. Via phpMyAdmin I am running this query: SELECT * from v2callbacks WHERE DATE_ADD(DATE_FORMAT(FROM_UNIXTIME(`entrydate`), '%m/%d/%Y'), INTERVAL 15 DAY) = '05/28/2008' I have a field that I set the entrydate to: 1211995559 (which is 05/28/2008) However, phpMyAdmin reports: MySQL returned an empty result set (i.e. zero rows). (Query took 0.0004 sec) Any suggestions? Link to comment https://forums.phpfreaks.com/topic/105446-solved-mysql-query-searching-for-future-date/#findComment-540108 Share on other sites More sharing options...
bsamson Posted May 13, 2008 Author Share Posted May 13, 2008 *bump* No suggestions? I have googled and search and cannot figure this one out... Link to comment https://forums.phpfreaks.com/topic/105446-solved-mysql-query-searching-for-future-date/#findComment-540194 Share on other sites More sharing options...
Barand Posted May 13, 2008 Share Posted May 13, 2008 Thanks for the input. But it doesn't appear to be working. Via phpMyAdmin I am running this query: SELECT * from v2callbacks WHERE DATE_ADD(DATE_FORMAT(FROM_UNIXTIME(`entrydate`), '%m/%d/%Y'), INTERVAL 15 DAY) = '05/28/2008' I have a field that I set the entrydate to: 1211995559 (which is 05/28/2008) However, phpMyAdmin reports: MySQL returned an empty result set (i.e. zero rows). (Query took 0.0004 sec) Any suggestions? If you are adding 15 days, the entrydate would need to be 5/13/2008 to get a match on 5/28/2008 Link to comment https://forums.phpfreaks.com/topic/105446-solved-mysql-query-searching-for-future-date/#findComment-540252 Share on other sites More sharing options...
Barand Posted May 13, 2008 Share Posted May 13, 2008 If you are looking for recs with an entrydate 15 days from now SELECT * from v2callbacks WHERE DATE(FROM_UNIXTIME(`entrydate`)) = CURDATE() + INTERVAL 15 DAY Link to comment https://forums.phpfreaks.com/topic/105446-solved-mysql-query-searching-for-future-date/#findComment-540277 Share on other sites More sharing options...
bsamson Posted May 13, 2008 Author Share Posted May 13, 2008 AWESOME!!!!! THANK YOU SO MUCH!!!!!! Link to comment https://forums.phpfreaks.com/topic/105446-solved-mysql-query-searching-for-future-date/#findComment-540285 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.