php - How to show only content from days before or equal to today? -


i have pretty simple question , i'm not sure why code have isn't working.

<div id="right_bottom"> <? list($y, $m, $d) = explode('-', $pagedata->program->start); foreach($pagedata->program->__workouts $day => $workout){    if (date('f j, y', mktime(0, 0 ,0, $m, $day, $y)) <= date('f j, y')){ ?>    <div id="right_side">     <div id="<?=$workout->id?>" class="side_items">      <a class="workouts" href="<?=$pagedata->program->id?>,<?=$day?>">      <img src="<?=protocol?>//<?=domain?>/img/workout/<?=$workout->image?>"><br />      <strong><?=$workout->title?></strong></a><br />      <h2><?=date('f j, y', mktime(0, 0 ,0, $m, $day, $y))?></h2><br />    </div>   </div>  <? } } ?> </div> 

i want if condition statement show "right_side" div days before or equal today.

it still showing days

what missing here?

i assume because trying compare 2 strings. try comparing unix time stamp instead:

if (mktime(0, 0 ,0, $m, $day, $y) <= time()){ 

hope helps!


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -