<?php

require_once('connectscr.php');

function getTERRACities()
{
  global $dbconnect;
  $citycheck = "SELECT Name FROM ort WHERE Einwohner>=100000 LIMIT 10";
  $dbconnect->real_escape_string($citycheck);
  $query = mysqli_query($dbconnect, $citycheck);
  $numrows = mysqli_num_rows($query);
  $cities = '';

  if ($numrows == 0) {
    $cities.= '<p>Keine Orte gefunden!</p>';
  }
  else {
    while($row = mysqli_fetch_assoc($query)) {
      $cities.= '<p>'.$row['Name'].'</p>';
    }
  }
  echo $cities;
}


function getGosford()
{
  global $dbconnect;
  echo '<br><h3>Länge von Gosford:</h3>';
  $city = 'Gosford';
  $sizecheck = "SELECT * FROM ort WHERE Name='$city'";
  $dbconnect->real_escape_string($sizecheck);
  $query2 = mysqli_query($dbconnect, $sizecheck);
  $fetch = mysqli_fetch_object($query2);
  $size = $fetch->Laenge;
  echo 'Länge: '.$size.' km';
}
