query("SELECT image FROM destinations WHERE id=$del_id")->fetch_assoc();
if ($row && !empty($row['image'])) {
$img_path = "../uploads/" . $row['image'];
if (file_exists($img_path)) unlink($img_path);
}
$conn->query("DELETE FROM destinations WHERE id=$del_id");
header("Location: destinations.php?msg=deleted");
exit;
}
$msg = $_GET['msg'] ?? '';
$dests = $conn->query("SELECT * FROM destinations ORDER BY name ASC");
?>
Destination saved successfully!
Destination deleted.
Image
Destination Name
Country Code
Created
Actions
num_rows > 0):
while ($d = $dests->fetch_assoc()):
$thumb = '';
// Check if DB has image path
if (!empty($d['image'])) {
$img_file = "../uploads/" . $d['image'];
if (file_exists($img_file)) $thumb = "../uploads/" . $d['image'];
}
// Fallback: static dest img map
$dest_imgs = [
'India' => '../assets/destinations img/WhatsApp Image 2026-05-08 at 15.03.52 (1).jpeg',
'Dubai' => '../assets/destinations img/WhatsApp Image 2026-05-08 at 15.06.04.jpeg',
'Egypt' => '../assets/destinations img/WhatsApp Image 2026-05-08 at 15.08.25.jpeg',
'China' => '../assets/destinations img/WhatsApp Image 2026-05-08 at 15.10.08.jpeg',
'Vietnam' => '../assets/destinations img/WhatsApp Image 2026-05-08 at 15.10.15.jpeg',
'Thailand' => '../assets/destinations img/WhatsApp Image 2026-05-08 at 15.12.15.jpeg',
'Singapore' => '../assets/destinations img/WhatsApp Image 2026-05-08 at 15.10.46.jpeg',
'Azerbaijan' => '../assets/destinations img/WhatsApp Image 2026-05-08 at 15.13.35.jpeg',
];
if (!$thumb && isset($dest_imgs[$d['name']])) {
$thumb = $dest_imgs[$d['name']];
}
?>
= htmlspecialchars($d['name']) ?>
= htmlspecialchars($d['country_code'] ?? '—') ?>
= isset($d['created_at']) ? date('d M Y', strtotime($d['created_at'])) : '—' ?>
Edit
Delete
No destinations yet. Add one now →