<?php require_once("header.php");?>

<?php
$numReview = mysqli_num_rows(mysqli_query($connection,"SELECT * FROM `og_reviews`"));
?>

			<!-- page template area start -->
			<section id="about">
				<div class="container mt-10 pb-10 pt-0">
					<div class="section-content">
						<div class="row">
							<div class="col-sm-12 col-md-12">
							    <h1 class="title mt-5 mb-15" style="text-align:center;">Happy Customers</h1>
							    <h3 class="title mt-5 mb-20" style="text-align:center; color:#d75500;"><?php echo $numReview;?> Review(s)</h3>
							    <?php
    							$sql_review = "SELECT * FROM `og_reviews` ORDER BY `review_id` DESC";
    							$exe_review = mysqli_query($connection,$sql_review);
    							while($arr_review = mysqli_fetch_array($exe_review))
    							{
    								$getProduct = mysqli_fetch_array(mysqli_query($connection,"SELECT * FROM `og_products` WHERE `product_id` = '".$arr_review['product_id']."'"));
    								$getUser = mysqli_fetch_array(mysqli_query($connection,"SELECT * FROM `og_users` WHERE `user_id` = '".$arr_review['user_id']."'"));
    								?>
							    <div class="col-sm-12 col-md-12" style="border:1px solid #ddd; background-color:#f1f1f1; border-radius:5px; padding:10px;">
							        <h3 style="margin:5px 0; color:#333333;"><?php echo stripslashes($getUser['fname']);?>&nbsp;<?php echo stripslashes($getUser['lname']);?></h3>
							        <div class="mb-10">
							            <?php if($arr_review['rate'] == '1') { ?>
							            <img src="images/rate.png" alt="">&nbsp;<img src="images/rate1.png" alt="">&nbsp;<img src="images/rate1.png" alt="">&nbsp;<img src="images/rate1.png" alt="">&nbsp;<img src="images/rate1.png" alt="">
							            <?php } ?>
							            <?php if($arr_review['rate'] == '2') { ?>
							            <img src="images/rate.png" alt="">&nbsp;<img src="images/rate.png" alt="">&nbsp;<img src="images/rate1.png" alt="">&nbsp;<img src="images/rate1.png" alt="">&nbsp;<img src="images/rate1.png" alt="">
							            <?php } ?>
							            <?php if($arr_review['rate'] == '3') { ?>
							            <img src="images/rate.png" alt="">&nbsp;<img src="images/rate.png" alt="">&nbsp;<img src="images/rate.png" alt="">&nbsp;<img src="images/rate1.png" alt="">&nbsp;<img src="images/rate1.png" alt="">
							            <?php } ?>
							            <?php if($arr_review['rate'] == '4') { ?>
							            <img src="images/rate.png" alt="">&nbsp;<img src="images/rate.png" alt="">&nbsp;<img src="images/rate.png" alt="">&nbsp;<img src="images/rate.png" alt="">&nbsp;<img src="images/rate1.png" alt="">
							            <?php } ?>
							            <?php if($arr_review['rate'] == '5') { ?>
							            <img src="images/rate.png" alt="">&nbsp;<img src="images/rate.png" alt="">&nbsp;<img src="images/rate.png" alt="">&nbsp;<img src="images/rate.png" alt="">&nbsp;<img src="images/rate.png" alt="">
							            <?php } ?>
							            </div>
									<div><?php echo nl2br(stripslashes($arr_review['comment']));?></div>
									<div><a href="product-details.php?product_id=<?php echo $arr_review['product_id'];?>" style="color:#d75500;"><?php echo stripslashes($getProduct['product_name_english']);?></a></div>
								</div>
								<div style="clear:both;">&nbsp;</div>
								<?php
    							}
    							?>
							</div>
						</div>
					</div>
				</div>
			</section>
			<!-- page template area end -->
			
<?php require_once("footer.php");?>