PHP foreach, if statement

the7k

New Member
I have a table listing several elements, and their expiration date.I need a function that says, "If the expiration date is later than today (for each element), then don't show".It seems pretty simple, but I'm stuck!Edit\[code\]<?php foreach($codes->result_array() as $row):?><tr> <td><?php print $row['description']?></td> <td><?php print $row['credits']?></td> <td><?php print $row['code']?></td> <td><? echo date("F jS, Y", strtotime($row['exp_date']));?></td> <td><? echo date("F jS, Y", strtotime($row['create_date']));?></td> <td> <!-- Icons --> <a href="http://stackoverflow.com/questions/2115300/<? echo base_url()?>admin/home/editCode/<?php print $row['id']?>" title="Edit"><img src="http://stackoverflow.com/questions/2115300/<? echo base_url()?>assets/images/icons/pencil.png" alt="Edit" /></a> <a href="http://stackoverflow.com/questions/2115300/<? echo base_url()?>admin/home/deleteCode/<?php print $row['id']?>" title="Delete" class="delete-code"><img src="http://stackoverflow.com/questions/2115300/<? echo base_url()?>assets/images/icons/cross.png" alt="Delete" /></a> </td><?php endforeach;?>\[/code\]
 
Back
Top