PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Within the loop below I only want to return echo "<br><h1>Future Engag</h1>"; once so that it displays better on the webpage. As it stands it naturally returns ‘Future Engag’ for each iteration of the loop for example
Future Engag
Today
Future Engag
Tomorrow
Future Engag
Next week
When I really need
Future Engag
Today
Tomorrow
Next week
How do I filter this out? I have been trying to use something like this in an array
// If any of the values are repeated set message.
if ($occurences > 1) {
echo Future Engag;
But this is still not working for me
Thanks for any pointers
Thanks for the reply.
Yeah I understand what you mean however I need this heading ‘Future Engag’ to only show if there are any dates in the database for coming year(s) and if there isn’t then it’s not needed.
The full code I’m using for this is as follows as I left out some in the pervious post as I thought it might not be necessary.
Any further thoughts?
Thanks
<?php
//first find out if you need to display the heading
$row_GetEngag = mysql_fetch_assoc($GetEngag);
$date = $row_GetEngag['heading'];
$date_new = substr($date, -4);
if($date_new > date("Y"))
echo "<br><h1>Future Engag</h1>";
//then echo all the items under that heading
while ($row_GetEngag = mysql_fetch_assoc($GetEngag))
echo "<a href=\"future.php?id=" . $row_GetEngag['eng_id'] . "\">" . $row_GetEngag['head'] . "</a><br />";
?>