0) {
$row = mysqli_fetch_assoc($result);
$image_name = $row['image'];
$target_dir = "assets/images/blogs_image/";
$target_file = $target_dir . $image_name;
// Delete the blog record from the database
$delete_query = "DELETE FROM blogs WHERE id='$blog_id'";
if (mysqli_query($conn, $delete_query)) {
// Delete the image file from the directory
if (file_exists($target_file)) {
unlink($target_file);
}
echo "";
} else {
echo "";
}
} else {
echo "";
}
mysqli_close($conn);
} else {
echo "";
}
?>