cjbeck71081 Posted September 16, 2008 Share Posted September 16, 2008 I have a membership sign up where a user signs up for an account online and a timestamp for thier sign up is puting the SQL table along with thier info. I would like to email the person when thier membership is older than 30 days and tell them that they have to check into thier account and update thier information. I know i can do this by brigning down the entries and calculating difference between dates... but i would like to run a query that does it for me. I have been looking into DATEDIFF and i think what i need is the syntax to properly pull down the email addresses of everyone whose membership is older than 30 days It might look like $result = "SELECT * FROM mytable WHERE DATEDIFF(`signup_date`, '$todays_date') > 30"; From there i could foreach($row = mysql_fetch_array($result)){ mail($row['email'],"Update your account", "Please update your account", $headers); } Any ideas... i'm sure my syntaxt is not even close on the SQL, but the idea is there. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 16, 2008 Share Posted September 16, 2008 Why not just WHERE signup_date < CURDATE() - INTERVAL 30 DAY ? Quote Link to comment Share on other sites More sharing options...
cjbeck71081 Posted September 16, 2008 Author Share Posted September 16, 2008 I am all for that, what is the proper syntaxt for that? Quote Link to comment Share on other sites More sharing options...
Barand Posted September 16, 2008 Share Posted September 16, 2008 I am all for that, what is the proper syntaxt for that? the correct syntax can be found here http://www.phpfreaks.com/forums/index.php/topic,216892.msg991854.html#msg991854 Quote Link to comment Share on other sites More sharing options...
fenway Posted September 16, 2008 Share Posted September 16, 2008 LOL. Quote Link to comment 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.