<div class="main"> <?php include("header.php"); ?> <?php include ("menu.php"); ?> <div class=magazin> <?php $link = mysqli_connect("localhost", "root", "usbw", "litle"); if ($link){ $sql ="SELECT * FROM `products`"; $result= mysqli_query($link, $sql); $_POST['hasce']="shop1.php"; if ($result){ while ($r = mysqli_fetch_assoc($result)){ echo " <div> <div><h1>".$r['name']."</h1> <h1>".$r['price']."</h1> <img src=".$r['src']." ></div> <p>".$r['description']."</p> <a href='shop1.php'>".Smatret."</a> </div> "; } } else { echo "harcum"; } } else { echo "kapi xndir"; }?> </div> <?php include("footer.php"); ?> |
1 answer
You need to link to the product view page to add the id of the product to be considered in detail. Something like this:
"<a href='shop1.php?id=".r['id'].">".Smatret."</a>" Further, when going to the shop1.php page, check for the availability of the get-parameter id and, accordingly, display product information with the given id
|