<?php
if (!in_array("Rechte", $_SESSION['Rechte'])) {
	exit(ZUGRIFF_ERROR);
}
if (!isset($_SESSION['ID'])) {
} else {
	echo "<h2>Gewerbeimmobilien</h2>\n";
	echo "<form action=\"index.php?".$_SERVER['QUERY_STRING']."\" method=\"post\" />\n";
	echo "	<label>Sortierung nach</label>\n";
	echo "	<select name=\"Sortierung\">\n";
	echo "		<option value=\"ID ASC\">Objekt-ID aufsteigend</option>\n";
	echo "		<option value=\"ID DESC\">Objekt-ID absteigend</option>\n";
	echo "		<option value=\"TID ASC\">Mitarbeiter aufsteigend</option>\n";
	echo "		<option value=\"TID DESC\">Mitarbeiter absteigend</option>\n";
	echo "		<option value=\"WohnF ASC\">Wohnfläche aufsteigend</option>\n";
	echo "		<option value=\"WohnF DESC\">Wohnfläche absteigend</option>\n";
	echo "		<option value=\"Mkalt ASC\">Kaltmiete / Kaufpreis aufsteigend</option>\n";
	echo "		<option value=\"Mkalt DESC\">Kaltmiete / Kaufpreis absteigend</option>\n";
	echo "		<option value=\"Datum ASC\">Erstelldatum aufsteigend</option>\n";
	echo "		<option value=\"Datum DESC\">Erstelldatum absteigend</option>\n";
	echo "		<option value=\"Akt_Datum ASC\">Änderungsdatum aufsteigend</option>\n";
	echo "		<option value=\"Akt_Datum DESC\">Änderungsdatum absteigend</option>\n";
	echo "		<option value=\"Count ASC\">Homepage-Zugriffe aufsteigend</option>\n";
	echo "		<option value=\"Count DESC\">Homepage-Zugriffe absteigend</option>\n";
	echo "	</select>\n";
	echo "	<br />\n";
	echo "	<label>&nbsp;</label>\n";
	echo "	<input type=\"submit\" name=\"action\" value=\"Sortieren\" />\n";
	echo "</form>\n";
	if (isset($_POST['action'])) {
		$order = ", ".$_POST['Sortierung'];
	}

// Wohnimmobilien - Abfrage
	$sql1 =		"SELECT ID, TID, Kurz, Art, WohnF, Mkalt, Count, DATE_FORMAT(Datum, \"%d.%m.%Y\") AS Datum, DATE_FORMAT(Akt_Datum, \"%d.%m.%Y\") AS Akt_Datum FROM objekte WHERE (O_TYP = \"Büro\" OR O_TYP = \"Praxis\") AND V_TYP = \"Miete\" AND Aktiv = \"1\" ORDER BY O_TYP ASC".$order.";";
	$result1 =	$db->query($sql1);
	$sql2 =		"SELECT ID, TID, Kurz, Art, WohnF, Mkalt, Count, DATE_FORMAT(Datum, \"%d.%m.%Y\") AS Datum, DATE_FORMAT(Akt_Datum, \"%d.%m.%Y\") AS Akt_Datum FROM objekte WHERE (O_TYP = \"Büro\" OR O_TYP = \"Praxis\") AND V_TYP = \"Miete\" AND Aktiv = \"0\" ORDER BY O_TYP ASC".$order.";";
	$result2 =	$db->query($sql2);
	$sql3 =		"SELECT ID, TID, Kurz, Art, WohnF, Mkalt, Count, DATE_FORMAT(Datum, \"%d.%m.%Y\") AS Datum, DATE_FORMAT(Akt_Datum, \"%d.%m.%Y\") AS Akt_Datum FROM objekte WHERE (O_TYP = \"Büro\" OR O_TYP = \"Praxis\") AND V_TYP = \"Kauf\" AND Aktiv = \"1\" ORDER BY O_TYP ASC".$order.";";
	$result3 =	$db->query($sql3);
	$sql4 =		"SELECT ID, TID, Kurz, Art, WohnF, Mkalt, Count, DATE_FORMAT(Datum, \"%d.%m.%Y\") AS Datum, DATE_FORMAT(Akt_Datum, \"%d.%m.%Y\") AS Akt_Datum FROM objekte WHERE (O_TYP = \"Büro\" OR O_TYP = \"Praxis\") AND V_TYP = \"Kauf\" AND Aktiv = \"0\" ORDER BY O_TYP ASC".$order.";";
	$result4 =	$db->query($sql4);
	$sql5 =		"SELECT ID, TID, Kurz, Art, WohnF, Mkalt, Count, DATE_FORMAT(Datum, \"%d.%m.%Y\") AS Datum, DATE_FORMAT(Akt_Datum, \"%d.%m.%Y\") AS Akt_Datum FROM objekte WHERE (O_TYP = \"Einzelhandel\" OR O_TYP = \"Industrie\") AND V_TYP = \"Miete\" AND Aktiv = \"1\" ORDER BY O_TYP ASC".$order.";";
	$result5 =	$db->query($sql5);
	$sql6 =		"SELECT ID, TID, Kurz, Art, WohnF, Mkalt, Count, DATE_FORMAT(Datum, \"%d.%m.%Y\") AS Datum, DATE_FORMAT(Akt_Datum, \"%d.%m.%Y\") AS Akt_Datum FROM objekte WHERE (O_TYP = \"Einzelhandel\" OR O_TYP = \"Industrie\") AND V_TYP = \"Miete\" AND Aktiv = \"0\" ORDER BY O_TYP ASC".$order.";";
	$result6 =	$db->query($sql6);
	$sql7 =		"SELECT ID, TID, Kurz, Art, WohnF, Mkalt, Count, DATE_FORMAT(Datum, \"%d.%m.%Y\") AS Datum, DATE_FORMAT(Akt_Datum, \"%d.%m.%Y\") AS Akt_Datum FROM objekte WHERE (O_TYP = \"Einzelhandel\" OR O_TYP = \"Industrie\") AND V_TYP = \"Kauf\" AND Aktiv = \"1\" ORDER BY O_TYP ASC".$order.";";
	$result7 =	$db->query($sql7);
	$sql8 =		"SELECT ID, TID, Kurz, Art, WohnF, Mkalt, Count, DATE_FORMAT(Datum, \"%d.%m.%Y\") AS Datum, DATE_FORMAT(Akt_Datum, \"%d.%m.%Y\") AS Akt_Datum FROM objekte WHERE (O_TYP = \"Einzelhandel\" OR O_TYP = \"Industrie\") AND V_TYP = \"Kauf\" AND Aktiv = \"0\" ORDER BY O_TYP ASC".$order.";";
	$result8 =	$db->query($sql8);
	$sql9 =		"SELECT ID, TID, Kurz, Art, WohnF, Mkalt, Count, DATE_FORMAT(Datum, \"%d.%m.%Y\") AS Datum, DATE_FORMAT(Akt_Datum, \"%d.%m.%Y\") AS Akt_Datum FROM objekte WHERE (O_TYP = \"Gastronomie\" OR O_TYP = \"Hotel\") AND V_TYP = \"Miete\" AND Aktiv = \"1\" ORDER BY O_TYP ASC".$order.";";
	$result9 =	$db->query($sql9);
	$sql10 =	"SELECT ID, TID, Kurz, Art, WohnF, Mkalt, Count, DATE_FORMAT(Datum, \"%d.%m.%Y\") AS Datum, DATE_FORMAT(Akt_Datum, \"%d.%m.%Y\") AS Akt_Datum FROM objekte WHERE (O_TYP = \"Gastronomie\" OR O_TYP = \"Hotel\") AND V_TYP = \"Miete\" AND Aktiv = \"0\" ORDER BY O_TYP ASC".$order.";";
	$result10 =	$db->query($sql10);
	$sql11 =	"SELECT ID, TID, Kurz, Art, WohnF, Mkalt, Count, DATE_FORMAT(Datum, \"%d.%m.%Y\") AS Datum, DATE_FORMAT(Akt_Datum, \"%d.%m.%Y\") AS Akt_Datum FROM objekte WHERE (O_TYP = \"Gastronomie\" OR O_TYP = \"Hotel\") AND V_TYP = \"Kauf\" AND Aktiv = \"1\" ORDER BY O_TYP ASC".$order.";";
	$result11 =	$db->query($sql11);
	$sql12 =	"SELECT ID, TID, Kurz, Art, WohnF, Mkalt, Count, DATE_FORMAT(Datum, \"%d.%m.%Y\") AS Datum, DATE_FORMAT(Akt_Datum, \"%d.%m.%Y\") AS Akt_Datum FROM objekte WHERE (O_TYP = \"Gastronomie\" OR O_TYP = \"Hotel\") AND V_TYP = \"Kauf\" AND Aktiv = \"0\" ORDER BY O_TYP ASC".$order.";";
	$result12 =	$db->query($sql12);
	
	echo "<table class=\"Objekt\">\n";
	echo "	<colgroup>\n";
	echo "		<col span=\"2\" width=\"30px\" />\n";
	echo "		<col width=\"230px\" />\n";
	echo "		<col width=\"100px\" />\n";
	echo "		<col span=\"4\" width=\"75px\" />\n";
	echo "		<col width=\"50px\" />\n";
	echo "	</colgroup>\n";
	
	echo "	<tr>\n";
	echo "		<td colspan=\"9\"><h3>aktive Gewerbeimmobilien</h3></td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<th colspan=\"9\">Büros / Praxen - Miete</th>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"underline\">\n";
	echo "		<td>ID</td>\n";
	echo "		<td>TID</td>\n";
	echo "		<td>Kurzbeschreibung</td>\n";
	echo "		<td>Typ</td>\n";
	echo "		<td>Fläche</td>\n";
	echo "		<td>KM</td>\n";
	echo "		<td>Erstellt</td>\n";
	echo "		<td>Geändert</td>\n";
	echo "		<td>Zugriffe</td>\n";
	echo "	</tr>\n";
	while ($bpma = $result1->fetch_assoc()) {
		echo "	<tr>\n";
		echo "		<td>".$bpma['ID']."</td>\n";
		echo "		<td>".$bpma['TID']."</td>\n";
		echo "		<td>".substr($bpma['Kurz'],0,30)."</td>\n";
		echo "		<td>".$bpma['Art']."</td>\n";
		echo "		<td>".$bpma['WohnF']." qm</td>\n";
		echo "		<td>".$bpma['Mkalt']." &euro;</td>\n";
		echo "		<td>".$bpma['Datum']."</td>\n";
		echo "		<td>".$bpma['Akt_Datum']."</td>\n";
		echo "		<td>".$bpma['Count']."</td>\n";
		echo "	</tr>\n";
	}

	echo "	<tr>\n";
	echo "		<th colspan=\"9\">Büros / Praxen - Kauf</th>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"underline\">\n";
	echo "		<td>ID</td>\n";
	echo "		<td>TID</td>\n";
	echo "		<td>Kurzbeschreibung</td>\n";
	echo "		<td>Typ</td>\n";
	echo "		<td>Fläche</td>\n";
	echo "		<td>KP</td>\n";
	echo "		<td>Erstellt</td>\n";
	echo "		<td>Geändert</td>\n";
	echo "		<td>Zugriffe</td>\n";
	echo "	</tr>\n";
	while ($bpka = $result3->fetch_assoc()) {
		echo "	<tr>\n";
		echo "		<td>".$bpka['ID']."</td>\n";
		echo "		<td>".$bpka['TID']."</td>\n";
		echo "		<td>".substr($bpka['Kurz'],0,30)."</td>\n";
		echo "		<td>".$bpka['Art']."</td>\n";
		echo "		<td>".$bpka['WohnF']." qm</td>\n";
		echo "		<td>".$bpka['Mkalt']." &euro;</td>\n";
		echo "		<td>".$bpka['Datum']."</td>\n";
		echo "		<td>".$bpka['Akt_Datum']."</td>\n";
		echo "		<td>".$bpka['Count']."</td>\n";
		echo "	</tr>\n";
	}

	echo "	<tr>\n";
	echo "		<th colspan=\"9\">Einzelhandel / Industrie - Miete</th>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"underline\">\n";
	echo "		<td>ID</td>\n";
	echo "		<td>TID</td>\n";
	echo "		<td>Kurzbeschreibung</td>\n";
	echo "		<td>Typ</td>\n";
	echo "		<td>Fläche</td>\n";
	echo "		<td>KM</td>\n";
	echo "		<td>Erstellt</td>\n";
	echo "		<td>Geändert</td>\n";
	echo "		<td>Zugriffe</td>\n";
	echo "	</tr>\n";
	while ($eima = $result5->fetch_assoc()) {
		echo "	<tr>\n";
		echo "		<td>".$eima['ID']."</td>\n";
		echo "		<td>".$eima['TID']."</td>\n";
		echo "		<td>".substr($eima['Kurz'],0,30)."</td>\n";
		echo "		<td>".$eima['Art']."</td>\n";
		echo "		<td>".$eima['WohnF']." qm</td>\n";
		echo "		<td>".$eima['Mkalt']." &euro;</td>\n";
		echo "		<td>".$eima['Datum']."</td>\n";
		echo "		<td>".$eima['Akt_Datum']."</td>\n";
		echo "		<td>".$eima['Count']."</td>\n";
		echo "	</tr>\n";
	}

	echo "	<tr>\n";
	echo "		<th colspan=\"9\">Einzelhandel / Industrie - Kauf</th>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"underline\">\n";
	echo "		<td>ID</td>\n";
	echo "		<td>TID</td>\n";
	echo "		<td>Kurzbeschreibung</td>\n";
	echo "		<td>Typ</td>\n";
	echo "		<td>Fläche</td>\n";
	echo "		<td>KP</td>\n";
	echo "		<td>Erstellt</td>\n";
	echo "		<td>Geändert</td>\n";
	echo "		<td>Zugriffe</td>\n";
	echo "	</tr>\n";
	while ($eika = $result7->fetch_assoc()) {
		echo "	<tr>\n";
		echo "		<td>".$eika['ID']."</td>\n";
		echo "		<td>".$eika['TID']."</td>\n";
		echo "		<td>".substr($eika['Kurz'],0,30)."</td>\n";
		echo "		<td>".$eika['Art']."</td>\n";
		echo "		<td>".$eika['WohnF']." qm</td>\n";
		echo "		<td>".$eika['Mkalt']." &euro;</td>\n";
		echo "		<td>".$eika['Datum']."</td>\n";
		echo "		<td>".$eika['Akt_Datum']."</td>\n";
		echo "		<td>".$eika['Count']."</td>\n";
		echo "	</tr>\n";
	}

	echo "	<tr>\n";
	echo "		<th colspan=\"9\">Gastronomie / Hotels - Miete</th>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"underline\">\n";
	echo "		<td>ID</td>\n";
	echo "		<td>TID</td>\n";
	echo "		<td>Kurzbeschreibung</td>\n";
	echo "		<td>Typ</td>\n";
	echo "		<td>Fläche</td>\n";
	echo "		<td>KM</td>\n";
	echo "		<td>Erstellt</td>\n";
	echo "		<td>Geändert</td>\n";
	echo "		<td>Zugriffe</td>\n";
	echo "	</tr>\n";
	while ($ghma = $result9->fetch_assoc()) {
		echo "	<tr>\n";
		echo "		<td>".$ghma['ID']."</td>\n";
		echo "		<td>".$ghma['TID']."</td>\n";
		echo "		<td>".substr($ghma['Kurz'],0,30)."</td>\n";
		echo "		<td>".$ghma['Art']."</td>\n";
		echo "		<td>".$ghma['WohnF']." qm</td>\n";
		echo "		<td>".$ghma['Mkalt']." &euro;</td>\n";
		echo "		<td>".$ghma['Datum']."</td>\n";
		echo "		<td>".$ghma['Akt_Datum']."</td>\n";
		echo "		<td>".$ghma['Count']."</td>\n";
		echo "	</tr>\n";
	}

	echo "	<tr>\n";
	echo "		<th colspan=\"9\">Gastronomie / Hotels - Kauf</th>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"underline\">\n";
	echo "		<td>ID</td>\n";
	echo "		<td>TID</td>\n";
	echo "		<td>Kurzbeschreibung</td>\n";
	echo "		<td>Typ</td>\n";
	echo "		<td>Fläche</td>\n";
	echo "		<td>KP</td>\n";
	echo "		<td>Erstellt</td>\n";
	echo "		<td>Geändert</td>\n";
	echo "		<td>Zugriffe</td>\n";
	echo "	</tr>\n";
	while ($ghka = $result11->fetch_assoc()) {
		echo "	<tr>\n";
		echo "		<td>".$ghka['ID']."</td>\n";
		echo "		<td>".$ghka['TID']."</td>\n";
		echo "		<td>".substr($ghka['Kurz'],0,30)."</td>\n";
		echo "		<td>".$ghka['Art']."</td>\n";
		echo "		<td>".$ghka['WohnF']." qm</td>\n";
		echo "		<td>".$ghka['Mkalt']." &euro;</td>\n";
		echo "		<td>".$ghka['Datum']."</td>\n";
		echo "		<td>".$ghka['Akt_Datum']."</td>\n";
		echo "		<td>".$ghka['Count']."</td>\n";
		echo "	</tr>\n";
	}

	echo "	<tr>\n";
	echo "		<td colspan=\"9\"><h3>inaktive Gewerbeimmobilien</h3></td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<th colspan=\"9\">Büros / Praxen - Miete</th>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"underline\">\n";
	echo "		<td>ID</td>\n";
	echo "		<td>TID</td>\n";
	echo "		<td>Kurzbeschreibung</td>\n";
	echo "		<td>Typ</td>\n";
	echo "		<td>Fläche</td>\n";
	echo "		<td>KM</td>\n";
	echo "		<td>Erstellt</td>\n";
	echo "		<td>Geändert</td>\n";
	echo "		<td>Zugriffe</td>\n";
	echo "	</tr>\n";
	while ($bpmi = $result2->fetch_assoc()) {
		echo "	<tr>\n";
		echo "		<td>".$bpmi['ID']."</td>\n";
		echo "		<td>".$bpmi['TID']."</td>\n";
		echo "		<td>".substr($bpmi['Kurz'],0,30)."</td>\n";
		echo "		<td>".$bpmi['Art']."</td>\n";
		echo "		<td>".$bpmi['WohnF']." qm</td>\n";
		echo "		<td>".$bpmi['Mkalt']." &euro;</td>\n";
		echo "		<td>".$bpmi['Datum']."</td>\n";
		echo "		<td>".$bpmi['Akt_Datum']."</td>\n";
		echo "		<td>".$bpmi['Count']."</td>\n";
		echo "	</tr>\n";
	}

	echo "	<tr>\n";
	echo "		<th colspan=\"9\">Büros / Praxen - Kauf</th>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"underline\">\n";
	echo "		<td>ID</td>\n";
	echo "		<td>TID</td>\n";
	echo "		<td>Kurzbeschreibung</td>\n";
	echo "		<td>Typ</td>\n";
	echo "		<td>Fläche</td>\n";
	echo "		<td>KP</td>\n";
	echo "		<td>Erstellt</td>\n";
	echo "		<td>Geändert</td>\n";
	echo "		<td>Zugriffe</td>\n";
	echo "	</tr>\n";
	while ($bpki = $result2->fetch_assoc()) {
		echo "	<tr>\n";
		echo "		<td>".$bpki['ID']."</td>\n";
		echo "		<td>".$bpki['TID']."</td>\n";
		echo "		<td>".substr($bpki['Kurz'],0,30)."</td>\n";
		echo "		<td>".$bpki['Art']."</td>\n";
		echo "		<td>".$bpki['WohnF']." qm</td>\n";
		echo "		<td>".$bpki['Mkalt']." &euro;</td>\n";
		echo "		<td>".$bpki['Datum']."</td>\n";
		echo "		<td>".$bpki['Akt_Datum']."</td>\n";
		echo "		<td>".$bpki['Count']."</td>\n";
		echo "	</tr>\n";
	}

	echo "	<tr>\n";
	echo "		<th colspan=\"9\">Einzelhandel / Industrie - Miete</th>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"underline\">\n";
	echo "		<td>ID</td>\n";
	echo "		<td>TID</td>\n";
	echo "		<td>Kurzbeschreibung</td>\n";
	echo "		<td>Typ</td>\n";
	echo "		<td>Fläche</td>\n";
	echo "		<td>KM</td>\n";
	echo "		<td>Erstellt</td>\n";
	echo "		<td>Geändert</td>\n";
	echo "		<td>Zugriffe</td>\n";
	echo "	</tr>\n";
	while ($eimi = $result6->fetch_assoc()) {
		echo "	<tr>\n";
		echo "		<td>".$eimi['ID']."</td>\n";
		echo "		<td>".$eimi['TID']."</td>\n";
		echo "		<td>".substr($eimi['Kurz'],0,30)."</td>\n";
		echo "		<td>".$eimi['Art']."</td>\n";
		echo "		<td>".$eimi['WohnF']." qm</td>\n";
		echo "		<td>".$eimi['Mkalt']." &euro;</td>\n";
		echo "		<td>".$eimi['Datum']."</td>\n";
		echo "		<td>".$eimi['Akt_Datum']."</td>\n";
		echo "		<td>".$eimi['Count']."</td>\n";
		echo "	</tr>\n";
	}

	echo "	<tr>\n";
	echo "		<th colspan=\"9\">Einzelhandel / Industrie - Kauf</th>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"underline\">\n";
	echo "		<td>ID</td>\n";
	echo "		<td>TID</td>\n";
	echo "		<td>Kurzbeschreibung</td>\n";
	echo "		<td>Typ</td>\n";
	echo "		<td>Fläche</td>\n";
	echo "		<td>KP</td>\n";
	echo "		<td>Erstellt</td>\n";
	echo "		<td>Geändert</td>\n";
	echo "		<td>Zugriffe</td>\n";
	echo "	</tr>\n";
	while ($eiki = $result8->fetch_assoc()) {
		echo "	<tr>\n";
		echo "		<td>".$eiki['ID']."</td>\n";
		echo "		<td>".$eiki['TID']."</td>\n";
		echo "		<td>".substr($eiki['Kurz'],0,30)."</td>\n";
		echo "		<td>".$eiki['Art']."</td>\n";
		echo "		<td>".$eiki['WohnF']." qm</td>\n";
		echo "		<td>".$eiki['Mkalt']." &euro;</td>\n";
		echo "		<td>".$eiki['Datum']."</td>\n";
		echo "		<td>".$eiki['Akt_Datum']."</td>\n";
		echo "		<td>".$eiki['Count']."</td>\n";
		echo "	</tr>\n";
	}

	echo "	<tr>\n";
	echo "		<th colspan=\"9\">Gastronomie / Hotels - Miete</th>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"underline\">\n";
	echo "		<td>ID</td>\n";
	echo "		<td>TID</td>\n";
	echo "		<td>Kurzbeschreibung</td>\n";
	echo "		<td>Typ</td>\n";
	echo "		<td>Fläche</td>\n";
	echo "		<td>KM</td>\n";
	echo "		<td>Erstellt</td>\n";
	echo "		<td>Geändert</td>\n";
	echo "		<td>Zugriffe</td>\n";
	echo "	</tr>\n";
	while ($ghmi = $result10->fetch_assoc()) {
		echo "	<tr>\n";
		echo "		<td>".$ghmi['ID']."</td>\n";
		echo "		<td>".$ghmi['TID']."</td>\n";
		echo "		<td>".substr($ghmi['Kurz'],0,30)."</td>\n";
		echo "		<td>".$ghmi['Art']."</td>\n";
		echo "		<td>".$ghmi['WohnF']." qm</td>\n";
		echo "		<td>".$ghmi['Mkalt']." &euro;</td>\n";
		echo "		<td>".$ghmi['Datum']."</td>\n";
		echo "		<td>".$ghmi['Akt_Datum']."</td>\n";
		echo "		<td>".$ghmi['Count']."</td>\n";
		echo "	</tr>\n";
	}

	echo "	<tr>\n";
	echo "		<th colspan=\"9\">Gastronomie / Hotels - Kauf</th>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"underline\">\n";
	echo "		<td>ID</td>\n";
	echo "		<td>TID</td>\n";
	echo "		<td>Kurzbeschreibung</td>\n";
	echo "		<td>Typ</td>\n";
	echo "		<td>Fläche</td>\n";
	echo "		<td>KP</td>\n";
	echo "		<td>Erstellt</td>\n";
	echo "		<td>Geändert</td>\n";
	echo "		<td>Zugriffe</td>\n";
	echo "	</tr>\n";
	while ($ghki = $result12->fetch_assoc()) {
		echo "	<tr>\n";
		echo "		<td>".$ghki['ID']."</td>\n";
		echo "		<td>".$ghki['TID']."</td>\n";
		echo "		<td>".substr($ghki['Kurz'],0,30)."</td>\n";
		echo "		<td>".$ghki['Art']."</td>\n";
		echo "		<td>".$ghki['WohnF']." qm</td>\n";
		echo "		<td>".$ghki['Mkalt']." &euro;</td>\n";
		echo "		<td>".$ghki['Datum']."</td>\n";
		echo "		<td>".$ghki['Akt_Datum']."</td>\n";
		echo "		<td>".$ghki['Count']."</td>\n";
		echo "	</tr>\n";
	}

	echo "</table>\n";

}
?>