dadamssg87 Posted November 29, 2011 Share Posted November 29, 2011 I have a "created" column in my table that uses CURRENT_TIMESTAMP. Can somebody help me write a query that pulls rows that are at least 30 days old? <?php $query = "SELECT * FROM Accounts where DateDiff(day,date(created),curdate()) > 30"; ?> I get this error with the above. #1582 - Incorrect parameter count in the call to native function 'DateDiff' Quote Link to comment https://forums.phpfreaks.com/topic/252052-pulling-row-that-are-at-least-30-days-old/ Share on other sites More sharing options...
Dazman2011 Posted November 29, 2011 Share Posted November 29, 2011 I tend to use something like WHERE date_field_to_test < DATE_SUB( NOW() , INTERVAL 30 DAY) Quote Link to comment https://forums.phpfreaks.com/topic/252052-pulling-row-that-are-at-least-30-days-old/#findComment-1292278 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.