我有这个代码,我想提取唯一的产品,然后将唯一产品的值发布到不同的页面。但它只粘贴搜索的值。
<?php include('header.php');?>
<!-- end header -->
<div class="container">
<div class="row">
<div class="col-lg-3">
</div>
<div class="col-lg-9">
<div class="row">
<div class="well well-sm " >
<strong>Category Title</strong>
<div class="btn-group" style="float:right;">
<a href="#" id="list" class="btn btn-themebtn-sm">
<i class="fa fa-list fa-1x"></i>List</a>
<span style= "padding:5px;"href="#" id="grid" class="btn btn-warning btn-sm"><i class="fa fa-th fa-1x"></i>Grid</span>
</div>
</div>
<?php
$query ="SELECT pname,pfeat,MIN(pprice) as minprice,MAX(pprice) as maxprice,count(*) as count FROM products where (pname like '%samsung%' AND conf=0) or (pmanu like '%samsung%' AND conf=0) GROUP BY pname ORDER BY count ;";
$stmt = $conn->prepare($query );
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC))
{
//extract row, this will make $row['firstname'] to just $firstname only
extract($row);
?>
<?php $par=$row['pname'];?>
<?php echo "<a href=pvendors.php?post=".$par.">".$row['pname']."</a>";?></h4>
<p class="group inner list-group-item-text">
<p>Retailers <?php echo $row['count'];?>
</p><?php echo $row['pfeat'];?>
</p>
<div class="row">
<div class="col-xs-12 col-md-6">
<p class="lead">
Price Range KSh.<?php echo $row['minprice'];?> - Ksh.<?php echo $row['maxprice'];?></p>
</div>