/var/www/vhosts/m-auto.co/httpdocs/admin
Edit: /var/www/vhosts/m-auto.co/httpdocs/admin/news_delete.php (771B)
prepare("SELECT image FROM news WHERE id = ?");
$stmt->bind_param("i", $id);
$stmt->execute();
$result = $stmt->get_result();
$article = $result->fetch_assoc();
if ($article && $article['image']) {
$image_path = '../uploads/news/' . $article['image'];
if (file_exists($image_path)) {
unlink($image_path);
}
}
// Delete the record from the database
$stmt = $conn->prepare("DELETE FROM news WHERE id = ?");
$stmt->bind_param("i", $id);
$stmt->execute();
header("Location: news.php");
exit;
}
?>