<div id="rspalte">
    <div id="galerie">

        <?php
        $sql2 = 'SELECT ID FROM bilder ORDER BY ID';
        $result2 = $db->query($sql2);
        $foto = "";
        while ($nt2 = $result2->fetch_assoc()) {
            $file = 'img/umgebung/bilder/' . $nt2['ID'] . '.jpg';
            if (file_exists($file)) {
                $foto = $nt2['ID'];
                echo '<a href="index.php?section=umgebung&f=' . $nt2['ID'] . '"><img src="' . $file . '" /></a>';
            }
        }
        ?>

    </div>
</div>

<div id="lspalte">
    <div id="bild">

        <?php

        if (isset($_GET['f'])) {
            $foto = $_GET['f'];
        }
        $sql1 = 'SELECT Head FROM bilder WHERE ID = "' . $foto . '"';
        $result1 = $db->query($sql1);
        $nt1 = $result1->fetch_assoc();
        $file = 'img/umgebung/bilder/' . $foto . '.jpg';
        echo "<h2>Bildergalerie</h2>\n";
        echo "<h3>$nt1[Head]</h3>\n";
        echo '<img src="' . $file . '" />';

        ?>

    </div>
</div>
<br class="clear"/>
&nbsp;