To fellow coders,
I am fairly new to coding in PHP and am working on a script to display forthcoming events on a website. I have got the code working so that it display all of the events from the database table, however when the event has past I want that event to disappear off the webpage so new events can appear.
Any help will be appreciated.
My current code is: -
PHP Code:
<?php
include("includes/db/connect.php");
$sql = "SELECT * FROM `events` WHERE active=1 AND eventDate > NOW() LIMIT 5";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result))
{
echo $row['eventName'];
echo "<br />";
echo $row['eventDate'];
echo "<br />";
echo $row['eventDescription'];
echo "<br />";
echo "<br />";
}
mysql_close();
?>
Thank you for your help in advance.