<?php
include("sess_page.php");
include("include/protect.php");
include("include/dbconnect.php");
extract($_REQUEST);
$pid=$_REQUEST['pid'];
$select = mysql_query("SELECT * FROM product_review where pid=$pid ")or die("user product_review error </br>".mysql_error());
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php include("include/title.php"); ?></title>
<link href="style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="include/menu.js"></script>
 <style type="text/css">
      #chart-container {
        width: 640px;
        height: auto;
      }
    </style>
<style type="text/css">
<!--
.style2 {color: #FFFFFF}
-->
</style>
<link rel="stylesheet" href="../css/bootstrap.min.css">
    <!-- Site CSS -->
    <link rel="stylesheet" href="../css/style.css">
    <!-- Responsive CSS -->
    <link rel="stylesheet" href="../css/responsive.css">
    <!-- Custom CSS -->
    <link rel="stylesheet" href="../css/custom.css">
</head>

<body><form id="form1" name="form1" method="post" action="">

 <header class="main-header">
        <!-- Start Navigation -->
        <nav class="navbar navbar-expand-lg navbar-light bg-light navbar-default bootsnav">
            <div class="container">
                <!-- Start Header Navigation -->
                <div class="navbar-header">
                    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-menu" aria-controls="navbars-rs-food" aria-expanded="false" aria-label="Toggle navigation">
                    <i class="fa fa-bars"></i>
                </button>
                    <a class="navbar-brand" href="index.html"><img src="../images/logo.png" class="logo" alt=""></a>
                </div>
                <!-- End Header Navigation -->

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse" id="navbar-menu">
                    <ul class="nav navbar-nav ml-auto" data-in="fadeInDown" data-out="fadeOutUp">
                        <li class="nav-item active "><a class="nav-link" href="user_page.php">Home</a></li>
						<li class="nav-item "><a class="nav-link" href="user_parchase_order.php">Products</a></li>
						<li class="nav-item "><a class="nav-link" href="user_purch_view.php">View Cart</a></li>
                        <li class="nav-item "><a class="nav-link" href="view_purchase.php">Purchases Details</a></li>
                        <li class="nav-item"><a class="nav-link" href="../index.html" >Logout</a></li>
                    </ul>
                </div>
                <!-- /.navbar-collapse -->

               
                <!-- End Atribute Navigation -->
            </div>
            <!-- Start Side Menu -->
            <div class="side">
                <a href="#" class="close-side"><i class="fa fa-times"></i></a>
                <li class="cart-box">
                    <ul class="cart-list">
                        <li>
                            <a href="#" class="photo"><img src="../images/bg2.jpg" class="cart-thumb" alt="" /></a>
                            <h6><a href="#">Delica omtantur </a></h6>
                            <p>1x - <span class="price">$80.00</span></p>
                        </li>
                        <li>
                            <a href="#" class="photo"><img src="../images/bg1.jpg" class="cart-thumb" alt="" /></a>
                            <h6><a href="#">Omnes ocurreret</a></h6>
                            <p>1x - <span class="price">$60.00</span></p>
                        </li>
                        <li>
                            <a href="#" class="photo"><img src="../images/bg1.jpg" class="cart-thumb" alt="" /></a>
                            <h6><a href="#">Agam facilisis</a></h6>
                            <p>1x - <span class="price">$40.00</span></p>
                        </li>
                        <li class="total">
                            <a href="#" class="btn btn-default hvr-hover btn-cart">VIEW CART</a>
                            <span class="float-right"><strong>Total</strong>: $180.00</span>
                        </li>
                    </ul>
                </li>
            </div>
            <!-- End Side Menu -->
        </nav>
        <!-- End Navigation -->
    </header>
    <!-- End Main Top -->

    <!-- Start Top Search -->
    <div class="top-search">
        <div class="container">
            <div class="input-group">
                <span class="input-group-addon"><i class="fa fa-search"></i></span>
                <input type="text" class="form-control" placeholder="Search">
                <span class="input-group-addon close-search"><i class="fa fa-times"></i></span>
            </div>
        </div>
    </div>
    <!-- End Top Search -->

    <!-- Start Slider -->
    <div id="slides-shop" class="cover-slides">
        <ul class="slides-container">
            <li class="text-center">
                <img src="../images/bg1.jpg" alt="">
                <div class="container">
                    <div class="row">
                        <div class="col-md-12">
                            <h1 class="m-b-20"><strong>Welcome To <br> Freshshop</strong></h1>
                            <p class="m-b-40">See how your users experience your website in realtime or view <br> trends to see any changes in performance over time.</p>
                           
                        </div>
                    </div>
                </div>
            </li>
            
            <li class="text-center">
                <img src="../images/bg3.jpg" alt="">
                <div class="container">
                    <div class="row">
                        <div class="col-md-12">
                            <h1 class="m-b-20"><strong>Welcome To <br> Freshshop</strong></h1>
                            <p class="m-b-40">See how your users experience your website in realtime or view <br> trends to see any changes in performance over time.</p>
                            
                        </div>
                    </div>
                </div>
            </li>
        </ul>
        
    </div>
  <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
    
    <tr>
      <td align="center" valign="top"><p>&nbsp;</p>
        <h3>Customer Information </h3>
        <table width="85%" height="58" border="0" align="center" class="table">
		<thead class="thead-dark">
          <tr bgcolor="#CC66CC">
		    <th bgcolor="#000066" scope="col"><span class="style2">
		      <label for="checkbox_row_2">Sno</label>
		      </span></th>
		    <th bgcolor="#000066" scope="col"><span class="style2">
		      <label for="checkbox_row_2">pid</label>
		      </span></th>
			   <th bgcolor="#000066" scope="col"><span class="style2">
		      <label for="checkbox_row_2">Username</label>
		      </span></th>
		    <th bgcolor="#000066" scope="col"><span class="style2">
		      <label for="checkbox_row_3">Star</label>
		      </span></th>
			  <th bgcolor="#000066" scope="col"><span class="style2">
		      <label for="checkbox_row_3">Review</label>
		      </span></th>
			  
			  
		    
          </tr>
		  </thead>
		  <?php
		  $r = 0;
		  while($rrow = mysql_fetch_array($select)){
		  $r++;
		  ?>
          <tr bgcolor="#CCCCFF">
            <td scope="col"><?php echo $r; ?></td>
            <td scope="col"><?php echo $rrow['pid']; ?></td>
			<td scope="col"><?php echo $rrow['uname']; ?></td>
            <td scope="col"><?php echo $rrow['star']; ?></td>
			<td scope="col"><?php echo $rrow['review']; ?></td>
			
           
          </tr>
		  <?php 
		  }
		  ?>
        </table>
        
      <?php
		$result = mysql_query("select count(*) FROM product_review where pid=$pid  ");
		$row = mysql_fetch_array($result);
		$total = $row[0];
		echo "Total Reviews: " . $total;		
		?> 

		 <?php
		 //select count(negative) from product_review pid="1" && negative="1"
		$result1 = mysql_query("select count(negative) FROM product_review where pid=$pid && negative='1' ");
		$row1 = mysql_fetch_array($result1);
		$total1 = $row1[0];
		echo "Total NegativeReviews: " . $total1;		
		?>  
		
		<?php
		 //select count(positive) from product_review pid="1" && negative="1"
		$result2 = mysql_query("select count(positive) FROM product_review where pid=$pid && positive='1' ");
		$row2 = mysql_fetch_array($result2);
		$total2 = $row2[0];
		echo "Total PositiveReviews: " . $total2;		
		?>  
		
	
  </table>
  <div class="footer-copyright">
        <p class="footer-company">&nbsp;</p>
    </div>
</form>

<script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/Chart.min.js"></script>
    <script type="text/javascript" src="app.js"></script>
<script src="../js/jquery-3.2.1.min.js"></script>
    <script src="../js/popper.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <!-- ALL PLUGINS -->
    <script src="../js/jquery.superslides.min.js"></script>
    <script src="../js/bootstrap-select.js"></script>
    <script src="../js/inewsticker.js"></script>
    <script src="../js/bootsnav.js."></script>
    <script src="../js/images-loded.min.js"></script>
    <script src="../js/isotope.min.js"></script>
    <script src="../js/owl.carousel.min.js"></script>
    <script src="../js/baguetteBox.min.js"></script>
    <script src="../js/form-validator.min.js"></script>
    <script src="../js/contact-form-script.js"></script>
    <script src="../js/custom.js"></script>
</body>
</html>
