/**
 * @author coster
 * checks if the parent has the same reservation
 * as the child room
 * */
function hasParentSameReservation($reservierungs_id)
{
    global $unterkunft_id;
    global $link;
    global $root;
    include_once $root . "/include/zimmerFunctions.php";
    $zi_id = getZimmerID($reservierungs_id, $link);
    if (!hasRoomParentRooms($zi_id)) {
        return false;
    }
    $gast = getIDFromGast($reservierungs_id, $link);
    $datum_von = getDatumVon($reservierungs_id, $link);
    $datum_bis = getDatumBis($reservierungs_id, $link);
    $status = getState($reservierungs_id, $link);
    $query = "SELECT\t\t \n\t\t\t   r.PK_ID\n\t\t\t   FROM\n\t\t\t   Rezervi_Reservierung r, Rezervi_Zimmer z\n\t\t\t   WHERE\t\t\t\t\n\t\t\t   FK_GAST_ID = '{$gast}' and" . " r.Datum_von = '{$datum_von}' and" . " r.Datum_bis = '{$datum_bis}' and" . " r.Status = '{$status}' and\n\t\t\t\t\tz.Parent_ID is null and \n\t\t\t\t\tr.FK_Zimmer_ID = z.PK_ID ";
    $res = mysqli_query($link, $query);
    if (!$res) {
        echo "die Anfrage scheitert";
        echo "<br/>" . mysqli_error();
    } else {
        $d = mysqli_fetch_array($res);
        $id = $d["PK_ID"];
        if (!empty($id)) {
            return true;
        }
    }
    return false;
}
<?php 
include_once "../templates/headerB.php";
include_once "../templates/bodyA.php";
//passwortprüfung:
if (checkPass($benutzername, $passwort, $unterkunft_id, $link)) {
    ?>
<p class="standardSchriftBold"><?php 
    echo getUebersetzung("Reservierungsanfragen von Gästen löschen", $sprache, $link);
    ?>
</p>
<?php 
    $gast_id = "";
    $vonDatum = "";
    $bisDatum = "";
    foreach ($reservierungen as $res_id) {
        $vonDatum = getDatumVon($res_id, $link);
        $bisDatum = getDatumBis($res_id, $link);
        $gast_id = getGastID($res_id, $link);
        $zimmer_id = getZimmerID($res_id, $link);
        deleteReservation($res_id, $link);
        //wenn room child rooms hat auch diese löschen:
        $resu = getChildRooms($zimmer_id);
        if (!empty($resu)) {
            while ($d = mysqli_fetch_array($resu)) {
                $child = $d['PK_ID'];
                deleteReservationWithDate($child, $vonDatum, $bisDatum, $link);
            }
        }
    }
    if ($gastEntfernen == "true") {
        //gast soll auch gelöscht werden:
                            <td><span
                                    class="standardSchriftBold"><?php 
            echo getUebersetzung("Anfrage von", $sprache, $link);
            ?>
                                    :</span> <?php 
            echo getGuestVorname($gast_id, $link) . " " . getGuestNachname($gast_id, $link);
            ?>
                            </td>
                        </tr>
                        <tr>
                            <td><span
                                    class="standardSchriftBold"><?php 
            echo getUebersetzung("Zeitraum", $sprache, $link);
            ?>
                                    :</span> von <?php 
            echo getDatumVon($reservierungs_id, $link);
            ?>
                                bis <?php 
            echo getDatumBis($reservierungs_id, $link);
            ?>
</td>
                        </tr>
                        <?php 
            //print all rooms with this reservation:
            $query2 = "SELECT \n\t\t\t\t\tr.PK_ID\n\t\t\t\t\tFROM\n\t\t\t\t\tRezervi_Reservierung r, Rezervi_Zimmer z\n\t\t\t\t\tWHERE\n\t\t\t\t\tz.FK_Unterkunft_ID = '{$unterkunft_id}' and\n\t\t\t\t\tz.PK_ID = r.FK_Zimmer_ID and\n\t\t\t\t\tr.Status = 1 and " . " r.FK_Gast_ID = '" . $d["FK_Gast_ID"] . "' and " . " r.Datum_von = '" . $d["Datum_von"] . "' and " . " r.Datum_bis = '" . $d["Datum_bis"] . "' and " . " r.ANFRAGEDATUM = '" . $d["ANFRAGEDATUM"] . "'";
            $res2 = mysqli_query($link, $query2);
            if (!$res2) {
                echo "die Anfrage scheitert";
                echo mysqli_error();
                echo $query;
            } else {
/**
 * calculates the price of a reservertion
 */
function calculatePriceOfReservation($reservation_id)
{
    global $root;
    global $link;
    include_once $root . "/include/reservierungFunctions.inc.php";
    $datumVon = getDatumVon($reservation_id, $link);
    $datumBis = getDatumBis($reservation_id, $link);
    $zimmer_id = getZimmerID($reservation_id, $link);
    $preis = calculatePrice($zimmer_id, $datumVon, $datumBis);
    return $preis;
}
             <div class="row">
                 <div class="col-sm-12">
                     <div class="alert alert-danger">
                         <?php 
         echo getUebersetzung("Folgende Reservierungen werden gelöscht", $sprache, $link);
         ?>
                         !
                     </div>
                 </div>
             </div>
         <?php 
     }
     $first = false;
     $pk_id = $d["PK_ID"];
     $gast_id = getGastID($pk_id, $link);
     $datumV = getDatumVon($pk_id, $link);
     $datumB = getDatumBis($pk_id, $link);
     $gast_nn = getGuestNachname($gast_id, $link);
     ?>
         <div class="row">
             <div class="col-sm-12">
                 <label class="control-label">
                     <?php 
     echo getUebersetzung("Reservierung von", $sprache, $link) . " " . $datumV . " " . getUebersetzung("bis", $sprache, $link) . " " . $datumB . ", " . getUebersetzung("Gast", $sprache, $link) . ": " . $gast_nn;
     ?>
                 </label>
             </div>
         </div>
         <?php 
 }
 //ende while reservierungen anzeigen