<?php
  include("database.php");

  $product = null;
  if (isset($_GET["id"]) && is_numeric($_GET["id"])) {
    $query = "SELECT * FROM items WHERE id = ".$_GET["id"];
    $result = mysqli_query($connection, $query);
    $product = mysqli_fetch_assoc($result);
  }
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Product Details</title>
  <style>
    div {
      padding: 5px 0px;
    }
  </style>
</head>
<body>
  <section>
    <?php
      if ($product) {
        echo "<div>Product: ".$product["name"]."</div>";
        echo "<div>Stock: ".$product["stock"]."</div>";
      } else {
        echo "<div>Product not found.</div>";
      }
    ?>
  </section>
</body>
</html>