function outputCountriesWithVisits($dbAdapter)
{
    $id = $_GET[continent];
    if (!empty($id) && !is_numeric($id) && strlen($id) == 2 && ctype_upper($id)) {
        $gateCountry = new CountryTableGateway($dbAdapter);
        $result = $gateCountry->findCountriesWithCountsById($id);
        echo '<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
          <thead>
            <tr>
              <th class="mdl-data-table__cell--non-numeric">Country</th>
              <th>Visits</th>
            </tr>
          </thead>
          <tbody>';
        foreach ($result as $row) {
            echo '<tr>
          <td class="mdl-data-table__cell--non-numeric">' . $row->CountryName . '</td>
          <td>' . $row->VisitsFromCountry . '</td>
          </tr>';
        }
        echo '</tbody>
            </table>';
    } else {
        echo "<h2>Chosen continent does not exist</h2>";
    }
}
function outputCountriesByContinent($dbAdapter)
{
    $userContinent = $_GET["continentCode"];
    $countryGate = new CountryTableGateway($dbAdapter);
    $result = $countryGate->findCountriesWithCountsById($userContinent);
    $countryInfoArray = [];
    foreach ($result as $row) {
        $countryInfo = new stdClass();
        $countryInfo->name = $row->CountryName;
        $countryInfo->visitCount = $row->VisitsFromCountry;
        array_push($countryInfoArray, $countryInfo);
    }
    echo json_encode($countryInfoArray);
}