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? 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"; 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 *Edit - you found your solution right as I was posting. 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 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
Archived
This topic is now archived and is closed to further replies.