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

	$id = $_POST['proid'];
	$sql = "SELECT * FROM mobileproducts WHERE prid='$id' 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"];
			
			?>
			<div class="row">
				<div class="col-md-12">
					<center><h5><?php echo $proname; ?></h5></center>
					<center><h5><?php echo $brandname; ?></h5></center>
					<center><h5>Rs. <?php echo number_format((float) $price,2); ?></h5></center>
					<center><h5>IN Stock : <?php echo $qty; ?></h5></center>
					<div class="row">
				<div class="col-md-5">
					<label class="mt-1">Discount</label>
					<input type="number" class="form-control" id="pro_dis" value="<?php echo $discount; ?>">
				</div>
				<div class="col-md-7">
					<label class="mt-1">Quantity</label>
					<input type="number" class="form-control" id="pro_qty" value="1">
				</div>

				</div>
			</div>
			<?php

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

	</div>

	<div class="row mt-2" id="errmsg" style="color: red;padding-left: 40px"></div>
      <div class="modal-footer">
      <button type="button" class="btn btn-success btn-sm btn-block" style="width: 100%" onclick="addToCart(<?php echo $prid; ?>, <?php echo $qty; ?>, <?php echo $price; ?>);">Add Cart</button>
      </div>
<?php 
}else if($userrole == "1"){
?>
<?php
	$id = $_POST['proid'];
	$sql = "SELECT * FROM mobileproducts WHERE prid='$id' 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"];
			?>
			<div class="row">
				<div class="col-md-12">
					<center><h5><?php echo $proname; ?></h5></center>
					<center><h5><?php echo $brandname; ?></h5></center>
					<center><h5>Rs. <?php echo number_format((float) $price,2); ?></h5></center>
					<center><h5>IN Stock : <?php echo $qty; ?></h5></center>
					<div class="row">
					<div class="col-md-5">
					<label class="mt-1">Discount</label>
					<input type="number" class="form-control" id="pro_dis" value="<?php echo $discount; ?>">
					</div>
					<div class="col-md-7">
					<label class="mt-1">Quantity</label>
					<input type="number" class="form-control" id="pro_qty" value="1">
					</div>
					</div>
			</div>
			<?php

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

	</div>

	<div class="row mt-2" id="errmsg" style="color: red;padding-left: 40px"></div>
    <div class="modal-footer">
    <button type="button" class="btn btn-success btn-sm btn-block" style="width: 100%" onclick="addToCart(<?php echo $prid; ?>, <?php echo $qty; ?>, <?php echo $price; ?>);">Add Cart</button>
    </div>
<?php 
}else{
?>
<?php

	$id = $_POST['proid'];
	$sql = "SELECT * FROM mobileproducts WHERE prid='$id' 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"];
			?>
			<div class="row">
				<div class="col-md-12">
					<center><h5><?php echo $proname; ?></h5></center>
					<center><h5><?php echo $brandname; ?></h5></center>
					<center><h5>Rs. <?php echo number_format((float) $price,2); ?></h5></center>
					<center><h5>IN Stock : <?php echo $qty; ?></h5></center>
					<div class="row">
				<div class="col-md-5">
					<label class="mt-1">Discount</label>
					<input type="number" class="form-control" id="pro_dis" value="<?php echo $discount; ?>">
				</div>
				<div class="col-md-7">
					<label class="mt-1">Quantity</label>
					<input type="number" class="form-control" id="pro_qty" value="1">
				</div>


				</div>
			</div>
			<?php

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

	</div>

	<div class="row mt-2" id="errmsg" style="color: red;padding-left: 40px"></div>
      <div class="modal-footer">
      <button type="button" class="btn btn-success btn-sm btn-block" style="width: 100%" onclick="addToCart(<?php echo $prid; ?>, <?php echo $qty; ?>, <?php echo $price; ?>);">Add Cart</button>
      </div>
<?php 
}
?>
	