prepare(" UPDATE blogs SET title = ?, content = ?, description = ?, category = ?, image = ?, author = ? WHERE blog_id = ? "); $stmt->bind_param("ssssssi", $title, $content, $description, $category, $cover_image_path, $author_id, $article_id); } else { $stmt = $conn->prepare(" UPDATE blogs SET title = ?, content = ?, description = ?, category = ?, author = ? WHERE blog_id = ? "); $stmt->bind_param("ssssii", $title, $content, $description, $category, $author_id, $article_id); } if ($stmt->execute()) { echo "Saved"; } else { http_response_code(500); echo "Database update failed: " . $stmt->error; }