$allWeekdays = getWeekdaysOfAdvent();
try {
    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    $sql = "SELECT * FROM solemnities_or_feasts";
    $result = $conn->query($sql);
    $datesSFM = array();
    $counter = 0;
    $LentWeekdays = getWeekdaysOfLent();
    $EasterWeekdays = getWeekdaysOfEaster();
    $AdventWeekdays = getWeekdaysOfAdvent();
    $OTSundays = getSundaysOfOT();
    $LentSundays = getSundaysOfLent();
    $EasterSundays = getSundaysOfEaster();
    $AdventSundays = getSundaysOfEaster();
    $lentwCount = count($LentWeekdays);
    $easterwCount = count($EasterWeekdays);
    $adventwCount = count($AdventWeekdays);
    $otsCount = count($OTSundays);
    $lentsCount = count($OTSundays);
    $eastersCount = count($OTSundays);
    $adventsCount = count($OTSundays);
    if ($result->num_rows > 0) {
        // output data of each row
        while ($row = $result->fetch_assoc()) {
            $dateToTest = $year . $row['date'];
            if ($row['rule'] == "replace SOT but not LEA") {
<?php

include_once 'eventDeterminant.php';
include_once 'functions.php';
//For Sunday
$allSundays = getSundaysOfOT();
$countOfSundays = count($allSundays);
//count of Sundays
$skipCheck = $weekAfterPentecost - $weeksBeforeLent;
//echo $skipCheck;