I am building a ecommerce site. Trying to create a product-details page where when clicking on a button it give me details of just that item. Database already created and connected but keep getting all items when clicking on one item instead of just the one I clicked on. Can I do it by id?
Here is my details.php code
<?php
$con = mysqli_connect('localhost','root');
mysqli_select_db($con, 'Test');
$sql = "SELECT * FROM products WHERE featured=1";
$featured = $con->query($sql); ?>
<div class="col"> <div class="col-md-8">
<div class="row">
<h2 class="text-center">Product Details</h2>
<?php
while($product =mysqli_fetch_assoc($featured)):
?>
<div class="col-md-5">
<h4> <?= $product['title'];?></h4>
<img src="<?= $product['images'];?>" height="200px" width="300px" alt="<?=
$product['title']; ?>" />
<p class="price">Price: <?= $product['price'];?></p>
<p class="desc">Description: <?= $product['description'];?></p>
<p class="bname">Brandname: <?= $product['brandname'];?></p>
</div>
<?php endwhile; ?>
</div>
</div>