I am trying to check if a date has passed or if it is the future. If the end_date has passed then I do not want it to display. end_date is a MySQL timestamp. Right now all news articles are displaying even if their end_date has passed. Here is the code I am using to check if the date has passed:
function dateExp( $timestamp ){
$exp = intval($timestamp);
$today = intval( time() );
if( $exp > today ) return true;
else return false;
}
Here is the code that gets the articles and displays them:
$qry = "select *
from news
where display='Y'
order by priority, date_added, title";
$news = _execQry($qry);
foreach( $news as $n )
{
if( dateExp($n['end_date']) ){
echo '<h3>'. $n['title'] .'</h3>';
echo '<p>'. $n['story'] ;
echo '<br />Added on '. dateFormat($n['date_added']) .'</p><br />';
}
}