barryflood22 Posted October 17, 2012 Share Posted October 17, 2012 i have a script which populates all listings in a table and echo's them as nicely laid out records on the front end. i want it to ignore all records which has had its "enddate" passed, below is what i have $sql = "SELECT * FROM $tbl_name ORDER BY dateposted DeSC LIMIT $start, $limit"; $closingdate ="enddate"; i want to add something like if $closingdate < todaysdate then ignore; any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/269587-ignore-certain-records-based-on-date/ Share on other sites More sharing options...
barryflood22 Posted October 17, 2012 Author Share Posted October 17, 2012 i worked it out myself :-) $cdate=date("Y-m-d"); // get the current date $sql = "SELECT * FROM $tbl_name where enddate>='$cdate' ORDER BY dateposted DeSC LIMIT $start, $limit"; Quote Link to comment https://forums.phpfreaks.com/topic/269587-ignore-certain-records-based-on-date/#findComment-1385807 Share on other sites More sharing options...
TOA Posted October 17, 2012 Share Posted October 17, 2012 (edited) *Edit - you found your solution right as I was posting. Edited October 17, 2012 by TOA Quote Link to comment https://forums.phpfreaks.com/topic/269587-ignore-certain-records-based-on-date/#findComment-1385808 Share on other sites More sharing options...
Barand Posted October 17, 2012 Share Posted October 17, 2012 or you could have used the mysql function CURDATE() to give you the current date Quote Link to comment https://forums.phpfreaks.com/topic/269587-ignore-certain-records-based-on-date/#findComment-1385883 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.