{source}
<?php

$discount = 0;
$today = date("Y-m-d");
$sql = "SELECT * FROM `events` WHERE `END` >= '" . $today . "' ORDER BY `START`";

$servername = "localhost";
$username = "roveror1_website";
$password = "R^+2,-wRu=Ao";
$dbname = "roveror1_website";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$result = $conn->query($sql);
$i = 0;

if ($result->num_rows > 0) {
    echo "<table style='border: 0; text-align: center; margin: 1em auto;'>";
    echo "<tbody>";
    echo "<tr style='height: 40px;'>";
    echo "<td> </td>";
    echo "<td style='width: 10px; background-color: #ffffff;'> </td>";
    echo "<td style='width: 950px; background-color: #ffffff;'>";
    echo "<h3 style='text-align: left;'><span style='font-size: 10pt;'>Please check the events section on the club forum for the latest information on events that the club will be attending.</span></h3>";
    echo "</td>";
    echo "<td style='width: 10px; background-color: #ffffff;'> </td>";
    echo "<td> </td>";
    echo "</tr>";
    echo "</tbody>";
    echo "</table>";
    echo "<table style='border: 0; text-align: center; margin: 1em auto;'>";
    echo "<tbody>";
    echo "<tr style='height: 40px;'>";
    echo "<td style='width: 10px; background-color: #eeeeee;'> </td>";
    echo "<td style='width: 200px; background-color: #eeeeee; text-align: left;'>";
    echo "<h4><strong>DATE</strong></h4>";
    echo "</td>";
    echo "<td style='width: 260px; background-color: #eeeeee; text-align: left;'>";
    echo "<h4><strong>SHOW</strong></h4>";
    echo "</td>";
    echo "<td style='width: 400px; background-color: #eeeeee; text-align: left;'>";
    echo "<h4><strong>LOCATION</strong></h4>";
    echo "</td>";
    echo "<td style='width: 80px; background-color: #eeeeee; text-align: left;'>";
    echo "<h4><strong>POSTCODE</strong></h4>";
    echo "</td>";
    echo "<td style='width: 20px; background-color: #eeeeee;'> </td>";
    echo "</tr>";
    echo "</tbody>";
    echo "</table>";

    while($row = mysqli_fetch_array($result)) {
        echo "<table style='border: 0; text-align: center; margin: 1em auto; padding-left: 10px;'>";
        echo "<tbody>";
        echo "<tr style='height: 40px;'>";
        echo "<td style='width: 10px;'> </td>";
        echo "<td style='width: 200px; text-align: left;'><span style='font-size: 9pt;'>" . $row['DISPLAY_DATE'] . "</span></td>";
        if ($row['EVENT_LINK']<>""){
            if ($row['DISCOUNT']>0){
                $discount = $discount + 1;
                echo "<td style='width: 260px; text-align: left;'><span style='font-size: 9pt;'><a href='" . $row['EVENT_LINK'] . "' target='blank'>" . $row['EVENT_NAME'] . "</a><font color='red'> *</font></span></td>";
            }else{
                echo "<td style='width: 260px; text-align: left;'><span style='font-size: 9pt;'><a href='" . $row['EVENT_LINK'] . "' target='blank'>" . $row['EVENT_NAME'] . "</a></span></td>";
            }
        }else{
            if ($row['DISCOUNT']>0){
                $discount = $discount + 1;
                echo "<td style='width: 260px; text-align: left;'><span style='font-size: 9pt;'>" . $row['EVENT_NAME'] . "<font color='red'> *</font></span></td>";
            }else{
                echo "<td style='width: 260px; text-align: left;'><span style='font-size: 9pt;'>" . $row['EVENT_NAME'] . "</span></td>";
            }
        }
        if ($row['LOCATION_LINK']<>""){
        echo "<td style='width: 400px; text-align: left;'><span style='font-size: 9pt;'><a href='" . $row['LOCATION_LINK'] . "' target='blank'>" . $row['LOCATION_NAME'] . "</a></span></td>";
        }else{
        echo "<td style='width: 400px; text-align: left;'><span style='font-size: 9pt;'><a href='" . $row['LOCATION_LINK'] . "' target='blank'>" . $row['LOCATION_NAME'] . "</a></span></td>";
        }
        echo "<td style='width: 80px; text-align: left;'><span style='font-size: 9pt;'><a href='" . $row['POSTCODE_LINK'] . "' target='blank'>" . $row['POSTCODE'] . "</a></span></td>";
        echo "<td style='width: 20px;'> </td>";
        echo "</tr>";
        if ($row['BANNER']<>''){
            echo "<tr style='height: 60px;'>";
            echo "<td style='width: 10px;'> </td>";
            echo "<td style='width: 940px; text-align: left;' colspan='4'><a href='" . $row['EVENT_LINK'] . "' target='blank'><img style='display: block; margin-left: auto; margin-right: auto;' src='/images/events/_banners/" . $row['BANNER'] . "' alt='' /></a></td>";
            echo "<td style='width: 20px;'> </td>";
            echo "</tr>";
        }
        echo "<tr style='height: 20px;'>";
        echo "<td colspan='8'><hr></td>";
        echo "</tbody>";
        echo "</table>";

    }

    echo "<table style='border: 0; text-align: center; margin: 1em auto;'>";
    echo "<tbody>";
    if ($discount > 0){
        echo "<tr style='height: 30px;'>";
        echo "<td style='width: 970px; text-align:center;'><font color='red'>*</font> - Discounted tickets for Club members for this event are available - please visit the <a href='https://rover200.org.uk/members'>Members Area</a> for more details</td>";
        echo "</tr>";
    }
    echo "<tr style='height: 30px;'>";
    echo "<td style='width: 970px; text-align:center;'> </td>";
    echo "</tr>";
    echo "</tbody>";
    echo "</table>";
    echo "<p> </p>";

} else {

    echo "<table style='border: 0; text-align: center; margin: 1em auto;'>";
    echo "<tbody>";
    echo "<tr style='height: 40px;'>";
    echo "<td> </td>";
    echo "<td style='width: 10px; background-color: #eeeeee;'> </td>";
    echo "<td style='width: 950px; background-color: #eeeeee; text-align: center;'>";
    echo "<span style='font-size: 11pt;'>Details of events that the club will be attending will be published here when available.</span>";
    echo "</td>";
    echo "<td style='width: 10px; background-color: #eeeeee;'> </td>";
    echo "<td> </td>";
    echo "</tr>";
    echo "</tbody>";
    echo "</table>";

}

$conn->close();
?> {/source}