Mr_jmm Posted February 3, 2008 Share Posted February 3, 2008 I ahve a table of website domains that also stores their renewal date. I am trying to write a query that will return a list of domains that are due to expire in the next 30 days. So far I have: <?php $query = mysql_query("SELECT website_domain, renewal_date FROM websites WHERE renewal_date = NOW(), +30 days"); ?> but this shows a sytax error. Could anyone help with this please? Many thanks as always, James Quote Link to comment https://forums.phpfreaks.com/topic/89181-solved-query-results-where-date-now-30-days/ Share on other sites More sharing options...
Mr_jmm Posted February 3, 2008 Author Share Posted February 3, 2008 Sorry, I think my starting place should be: <?php $query = mysql_query("SELECT website_domain, renewal_date FROM websites WHERE renewal_date BETWEEN NOW(), 30 days"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/89181-solved-query-results-where-date-now-30-days/#findComment-456652 Share on other sites More sharing options...
Mr_jmm Posted February 3, 2008 Author Share Posted February 3, 2008 SOLVED! <?php $renewal_query = mysql_query('SELECT website_title, website_domain, renewal_date FROM websites WHERE renewal_date > NOW() AND renewal_date < adddate(NOW(), INTERVAL 30 DAY)'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/89181-solved-query-results-where-date-now-30-days/#findComment-456673 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.