i am trying to make a website for a shop. On the products page, i display general information about all the products loaded from the database. i want to create a separate page that will show different text and image based on which product the user clicks on (i want users to go to this page when they click on any of the products). Is this possible or do i need to code a new page everytime a product is added?
<?php
$sql = "SELECT * FROM products;";
$result = mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($result);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
};
if ($resultCheck > 0) {
while($row = mysqli_fetch_assoc($result)){
echo "<div class='productCard'>";
echo '<img src="data:image/jpeg;base64,'.base64_encode($row['image']).'"/>';
echo "<h1>" .$row["name"]. "</h1>
<h1>" .$row["stock"]. "</h1>
</div>";
}
} else {
echo "0 results";
}
?>