0) { $select_row = mysqli_fetch_assoc($select_result); $image_name = $select_row['s_image']; $image_path = "service_image/" . $image_name; // Delete the image file if it exists if (file_exists($image_path)) { unlink($image_path); } // Delete the record from the database $delete_service = "DELETE FROM services WHERE s_id = $s_id"; $delete_result = mysqli_query($con, $delete_service); if ($delete_result) { $_SESSION['service_delete'] = "Service deleted successfully!"; } else { $_SESSION['service_delete'] = "Service delete failed!"; } } else { $_SESSION['service_delete'] = "Service not found!"; } header('Location: services.php'); exit; } else { header('Location: services.php'); exit; } ?>