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

	require_once 'db_connection.php'; 
	$str = $_POST['str'];
	$type = $_POST['types'];
	if($type==1){
	$sql = "SELECT * FROM mobileproducts WHERE proname LIKE  '%$str%' AND status=1";

}

if($type==2){
	$sql = "SELECT * FROM mobileproducts WHERE prcode='$str' AND 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-4 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 
}else if($userrole == "1"){
?>
<?php
	require_once 'db_connection.php'; 
	$str = $_POST['str'];
	$type = $_POST['types'];
	if($type==1){
	$sql = "SELECT * FROM mobileproducts WHERE proname LIKE  '%$str%' AND status=1";
}

if($type==2){
	$sql = "SELECT * FROM mobileproducts WHERE prid='$str' AND 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-4 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 
}else{
?>
<?php
	require_once 'db_connection.php'; 
	$str = $_POST['str'];
	$type = $_POST['types'];
	if($type==1){
	$sql = "SELECT * FROM mobileproducts WHERE proname LIKE  '%$str%' AND status=1";
}

if($type==2){
	$sql = "SELECT * FROM mobileproducts WHERE prid='$str' AND 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-4 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 
}
?>
		