I have a php file with the following code and i am trying to not display information after todays date. my incl_frontpageschedule.inc is listed below as well. im new to php and think i am close but confused at the moment any help would be great.

<?php
$today = date("F jS");

$filename="incl_frontpageschedule.inc";
$fh=fopen($filename, 'r');
$data=fread($fh, filesize($filename));
fclose($fh);
$splitcontents=explode(",", $data);
foreach ($splitcontents as $CurrentVal)


{
    list($Date, $Name) = explode(',', trim($data) );
    if ($today > $Date)
        {echo $CurrentVal."\n";}
}



PRINT "$today";
?>



This is include file. 
<div id="eventboxhome"> 
<div class="EventDate">May 12th, - big band</div> 
<div class="EventDate">May 19th, - another Band</div> 
<div class="EventDate">June 2nd, - band 3</div> 
<div class="EventDate">June 16th, - band 4</div> 
<div class="EventDate">June 30th, - band 5</div> 
<div class="EventDate">July 14th, - band 6</div> 
<div class="EventDate">July 20th, - band 7</div> 
<div class="EventDate">July 28th, - band 8</div> 
</div>

Also how can i limit it to show only the first 4 events comming up.

The purpose is so i can load a years worth of dates and they will automacally remove them self after the date has past and show the next one on the list.  
Member Avatar for jmichae3

don't you mean "Y-m-d"? you want the year, instead of 2 dates, don't you? the SQL date format is string comparable. think about it. it has leading zeros. consider comparing 2007-12-01 and 2009-01-31
this kind of format is numerically sortable. because it is, it is also comparable with < and > and other relops.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.