<h1>Immobilien Gewerbe</h1>
<h2>Bitte wählen Sie die gewünschte Kategorie</h2>

<?php
	$sqlr		= 'SELECT Kurz FROM ObR WHERE Wert = "on" AND Sektion = "gewerbe";';
	$resultr	= $db->query($sqlr);
	
	while ($ntr = $resultr->fetch_assoc()) {
		if ("bp" == $ntr['Kurz']) {
			$sql1 = 'SELECT ID FROM objekte WHERE (O_TYP = "Büro" OR O_TYP = "Praxis") AND Aktiv = 1 ORDER BY ID ASC';
			$result1 = $db->query($sql1);
			$anzahl1 = $result1->num_rows;
			$nt1 = $result1->fetch_assoc();
			echo "<a href=\"index.php?section=gewerbe&t=bp\" class=\"nounder\">\n";
			echo "<div class=\"haupt\">\n";
			echo "<table> \n";
			echo "    <colgroup>\n";
			echo "        <col width=\"100px\" />\n";
			echo "        <col width=\"320px\" />\n";
			echo "    </colgroup>\n";
			echo "    <tr>\n";
			echo "        <td rowspan=\"2\">\n";
			$file = "img/objekte/".$nt1['ID']."_1.jpg";
			if (file_exists($file)) {
				echo "<img src=\"img/objekte/".$nt1['ID']."_1.jpg\" width=\"80px\" height=\"60px\" />\n";
			}
			echo "</td>\n";
			echo "        <td><h1>Büros / Praxen</h1></td>\n";
			echo "    </tr>\n";
			echo "    <tr>\n";
			echo "        <td><h2>Zur Zeit haben wir $anzahl1 Objekte</h2></td>\n";
			echo "    </tr>\n";
			echo "</table>\n";
			echo "</div>\n";
			echo "</a>\n";
		} elseif ("ei" == $ntr['Kurz']) {
			$sql2 = 'SELECT ID FROM objekte WHERE (O_TYP = "Einzelhandel" OR O_TYP = "Industrie") AND Aktiv = 1 ORDER BY ID ASC';
			$result2 = $db->query($sql2);
			$anzahl2 = $result2->num_rows;
			$nt2 = $result2->fetch_assoc();
			echo "<a href=\"index.php?section=gewerbe&t=ei\" class=\"nounder\">\n";
			echo "<div class=\"haupt\">\n";
			echo "<table> \n";
			echo "    <colgroup>\n";
			echo "        <col width=\"100px\" />\n";
			echo "        <col width=\"320px\" />\n";
			echo "    </colgroup>\n";
			echo "    <tr>\n";
			echo "        <td rowspan=\"2\">\n";
			$file = "img/objekte/".$nt2['ID']."_1.jpg";
			if (file_exists($file)) {
				echo "<img src=\"img/objekte/".$nt2['ID']."_1.jpg\" width=\"80px\" height=\"60px\" />\n";
			}
			echo "</td>\n";
			echo "        <td><h1>Einzelhandel / Industrie</h1></td>\n";
			echo "    </tr>\n";
			echo "    <tr>\n";
			echo "        <td><h2>Zur Zeit haben wir $anzahl2 Objekte</h2></td>\n";
			echo "    </tr>\n";
			echo "</table>\n";
			echo "</div>\n";
			echo "</a>\n";
		} elseif ("gh" == $ntr['Kurz']) {
			$sql3 = 'SELECT ID FROM objekte WHERE (O_TYP = "Gastronomie" OR O_TYP = "Hotel") AND Aktiv = 1 ORDER BY ID ASC';
			$result3 = $db->query($sql3);
			$anzahl3 = $result3->num_rows;
			$nt3 = $result3->fetch_assoc();
			echo "<a href=\"index.php?section=gewerbe&t=gh\" class=\"nounder\">\n";
			echo "<div class=\"haupt\">\n";
			echo "<table> \n";
			echo "    <colgroup>\n";
			echo "        <col width=\"100px\" />\n";
			echo "        <col width=\"320px\" />\n";
			echo "    </colgroup>\n";
			echo "    <tr>\n";
			echo "        <td rowspan=\"2\">\n";
			$file = "img/objekte/".$nt3['ID']."_1.jpg";
			if (file_exists($file)) {
				echo "<img src=\"img/objekte/".$nt3['ID']."_1.jpg\" width=\"80px\" height=\"60px\" />\n";
			}
			echo "</td>\n";
			echo "        <td><h1>Gastronomie / Hotels</h1></td>\n";
			echo "    </tr>\n";
			echo "    <tr>\n";
			echo "        <td><h2>Zur Zeit haben wir $anzahl3 Objekte</h2></td>\n";
			echo "    </tr>\n";
			echo "</table>\n";
			echo "</div>\n";
			echo "</a>\n";
		} elseif ("mf" == $ntr['Kurz']) {
			$sql4 = 'SELECT ID FROM objekte WHERE O_TYP = "Multi" AND Aktiv = 1 ORDER BY ID ASC';
			$result4 = $db->query($sql4);
			$anzahl4 = $result4->num_rows;
			$nt4 = $result4->fetch_assoc();
			echo "<a href=\"index.php?section=gewerbe&t=mf\" class=\"nounder\">\n";
			echo "<div class=\"haupt\">\n";
			echo "<table> \n";
			echo "    <colgroup>\n";
			echo "        <col width=\"100px\" />\n";
			echo "        <col width=\"320px\" />\n";
			echo "    </colgroup>\n";
			echo "    <tr>\n";
			echo "        <td rowspan=\"2\">\n";
			$file = "img/objekte/".$nt4['ID']."_1.jpg";
			if (file_exists($file)) {
				echo "<img src=\"img/objekte/".$nt4['ID']."_1.jpg\" width=\"80px\" height=\"60px\" />\n";
			}
			echo "</td>\n";
			echo "        <td><h1>Multifunktionsobjekte</h1></td>\n";
			echo "    </tr>\n";
			echo "    <tr>\n";
			echo "        <td><h2>Zur Zeit haben wir $anzahl4 Objekte</h2></td>\n";
			echo "    </tr>\n";
			echo "</table>\n";
			echo "</div>\n";
			echo "</a>\n";
		}
	}





?>