prepare('SELECT * FROM products WHERE slug = :slug'); $stmt->bindParam(':slug', $slug, PDO::PARAM_STR); $stmt->execute(); $product = $stmt->fetch(PDO::FETCH_ASSOC); if (!$product) { http_response_code(404); $error_message = "Product not found."; } } catch (PDOException $e) { $error_message = "Database error: " . $e->getMessage(); } function format_price($price) { return 'đ' . number_format($price, 0, ',', '.'); } $page_title = $product ? $product['name'] : 'Product Not Found'; $meta_description = $product ? htmlspecialchars($product['description']) : 'The requested product could not be found.'; ?>