<?php
include '../../db.php';
include '../../function.php';
$db = new DB();
$id = $_GET['id'];
$room = getOneRoom($id);
$roomImg = getAllRoomsPhotos($id);
foreach ($roomImg as $gallery) {
unlink('../../images/rooms/gallery/' . $gallery['image_name']);
unlink('../../images/rooms/gallery/thumb/' . $gallery['image_name']);
$db->readQuery("DELETE FROM `rooms_photos` WHERE `id` = '" . $gallery['id'] . "'");
}
$file1 = '../../images/rooms/' . $room['image_name'];
unlink($file1);
$sql = "DELETE FROM `rooms` WHERE `id` = '$id'";
$db = new DB();
if ($db->readQuery($sql)) {
header('Location: ' . $_SERVER['HTTP_REFERER']);
}
|