<div class="row ">
<?php 
session_start();
require_once 'db_connection.php';
?>
<?php 
if($userrole == "7"){
?>
<?php

	$id = $_POST['id'];
	if($id>0){
		$sql = "SELECT * FROM mobileproducts WHERE category='$id' AND status=1";
	}else{
		$sql = "SELECT * FROM mobileproducts WHERE status=1";
	}
	$result = $conn->query($sql);

	if ($result->num_rows > 0) {
  // output data of each row
		while($row = $result->fetch_assoc()){
			
			$prid = $row["prid"];
			$brandname = $row["brandname"];
			$proname = $row["proname"];
			$discount = $row["discount"];
			$price = $row["sellprice"];
			$qty = $row["qty"];
			$cover = $row["cover"];
			
			?>
			<div class="col-lg-3 col-sm-3 d-flex " onclick="selectProduct(<?php echo $row['prid']; ?>);">
				<div class="productset flex-fill">
					<div class="productsetimg">
						<?php if($cover==""){$pro_img="images/empty.jpg";}else{$pro_img="images/products/cover/".$cover;} ?><img src="<?php echo $pro_img; ?>" alt="" style="width:100%;height:250px;">
						<div class="check-product">
							<i class="fa fa-check"></i>
						</div>
					</div>
					<div class="productsetcontent">
						<h6 class="btn btn-block btn-sm btn-outline-success active text-white"><?php echo $proname; ?></h6><hr>
						<p class="btn btn-block btn-sm btn-outline-info"><?php echo $brandname; ?></p><hr>
						<h5 class="btn btn-block btn-sm btn-outline-dark active text-white">Rs.<?php echo number_format((float) $price,2);
						if($discount>0){
							echo "  (".$discount."%)";
						} ?></h5>
						<p class="btn btn-block btn-sm btn-outline-danger active">IN STOCK : <?php echo $qty; ?></p>
					</div>
				</div>
			</div>
			<?php

		}
	} else {
		echo "Not Found Any Products..";
	}
	$conn->close();
	?>
<?php 
}else if($userrole == "5"){
?>
<?php
	$id = $_POST['id'];
	if($id>0){
		$sql = "SELECT * FROM mobileproducts WHERE category='$id' AND status=1";
	}else{
		$sql = "SELECT * FROM mobileproducts WHERE status=1";
	}
	$result = $conn->query($sql);

	if ($result->num_rows > 0) {
  // output data of each row
		while($row = $result->fetch_assoc()) {
			$prid = $row["prid"];
			$proname = $row["proname"];
			$discount = $row["discount"];
			$price = $row["sellprice"];
			$qty = $row["qty"];
			$cover = $row["cover"];
			?>
			<div class="col-lg-3 col-sm-3 d-flex " onclick="selectProduct(<?php echo $row['prid']; ?>);">
				<div class="productset flex-fill">
					<div class="productsetimg">
						<?php if($cover==""){$pro_img="images/empty.jpg";}else{$pro_img="images/products/cover/".$cover;} ?><img src="<?php echo $pro_img; ?>" alt="" style="width:100%;height:250px;">
						<div class="check-product">
							<i class="fa fa-check"></i>
						</div>
					</div>
					<div class="productsetcontent">
						<h6 class="btn btn-block btn-sm btn-outline-success active text-white"><?php echo $proname; ?></h6><hr>
						<p class="btn btn-block btn-sm btn-outline-info"><?php echo $brandname; ?></p><hr>
						<h5 class="btn btn-block btn-sm btn-outline-dark active text-white">Rs.<?php echo number_format((float) $price,2);
						if($discount>0){
							echo "  (".$discount."%)";
						} ?></h5>
						<p class="btn btn-block btn-sm btn-outline-danger active">IN STOCK : <?php echo $qty; ?></p>
					</div>
				</div>
			</div>
			<?php

		}
	} else {
		echo "Not Found Any Products..";
	}
	$conn->close();
	?>
<?php 
}else{
?>
<?php
	$id = $_POST['id'];
	if($id>0){
		$sql = "SELECT * FROM mobileproducts WHERE category='$id' AND status=1";
	}else{
		$sql = "SELECT * FROM mobileproducts WHERE status=1";
	}
	$result = $conn->query($sql);

	if ($result->num_rows > 0) {
  // output data of each row
		while($row = $result->fetch_assoc()) {
			$prid = $row["prid"];
			$proname = $row["proname"];
			$discount = $row["discount"];
			$price = $row["sellprice"];
			$qty = $row["qty"];
			$cover = $row["cover"];
			?>
			<div class="col-lg-3 col-sm-3 d-flex " onclick="selectProduct(<?php echo $row['prid']; ?>);">
				<div class="productset flex-fill">
					<div class="productsetimg">
						<?php if($cover==""){$pro_img="images/empty.jpg";}else{$pro_img="images/products/cover/".$cover;} ?><img src="<?php echo $pro_img; ?>" alt="" style="width:100%;height:250px;">
						<div class="check-product">
							<i class="fa fa-check"></i>
						</div>
					</div>
					<div class="productsetcontent">
						<h6 class="btn btn-block btn-sm btn-outline-success active text-white"><?php echo $proname; ?></h6><hr>
						<p class="btn btn-block btn-sm btn-outline-info"><?php echo $brandname; ?></p><hr>
						<h5 class="btn btn-block btn-sm btn-outline-dark active text-white">Rs.<?php echo number_format((float) $price,2);
						if($discount>0){
							echo "  (".$discount."%)";
						} ?></h5>
						<p class="btn btn-block btn-sm btn-outline-danger active text-white">IN STOCK : <?php echo $qty; ?></p>
					</div>
				</div>
			</div>
			<?php

		}
	} else {
		echo "Not Found Any Products..";
	}
	$conn->close();
	?>
<?php 
}
?>
	