public static function delete($id) { global $db; $db->query("SELECT id FROM flat WHERE tenement_id={$id}"); $rows = $db->fetchAll(); foreach ($rows as $row) { Flat::delete($row['id']); } $db->query("DELETE FROM tenement WHERE id={$id}"); Photo::deletePhotos(TENEMENT, $id); }
function delete() { if (!isset($_SESSION['admin'])) { echo "Not admin"; //header("Location: /index.html"); exit(); } $id = intval($_REQUEST['id']); Flat::delete($id); header("Location: ".$_SERVER['HTTP_REFERER']); }