<div class="row ">
    <?php
	session_start();
	require_once 'db_connection.php';

	$searchbarcode = $_POST['category'];
	if ($searchbarcode) {
		$sql = "SELECT * FROM mobileproducts WHERE category='$searchbarcode' 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"];
			$mqty = $row["mqty"];
			$itemcode = $row["itemcode"];

			$user_qury_02 = mysqli_query($conn, "SELECT * FROM tbl_user_branch WHERE user_id='" . $_SESSION['user_id'] . "'");
			$user_res = mysqli_fetch_assoc($user_qury_02);
			$user_branch = $user_res['branch_id'];

			$user_qury_03 = mysqli_query($conn, "SELECT * FROM tbl_stock WHERE prid = '$prid' AND branch_id='$user_branch'");
			$user_res1 = mysqli_fetch_assoc($user_qury_03);
			$sqty = $user_res1['qty'];

	?>
    <div class="div_wrap" onclick="addProductById(<?php echo $row['prid']; ?>);">
        <div class="fix_textnps">
            <div class="image_images">
                <?php if ($cover == "") {
							$pro_img = "images/eimage.png";
						} else {
							$pro_img = "images/products/cover/" . $cover;
						} ?><img src="<?php echo $pro_img; ?>" alt="">

                <h6>
                    <?php echo $proname; ?>
                </h6>
            </div>
            <p>
                <?php echo $itemcode; ?>
            </p>
            <?php //if ($user_res1['qty'] < $mqty) {
					if ($user_res1['qty'] < 1) { ?>
            <h6 class="text-primary">
                Qty Low <?php if ($user_res1['qty'] != 0) : ?> | <?php echo $user_res1['qty'];
																			endif; ?>
            </h6>
            <?php } else { ?>
            <h6 class="text-primary">Qty : <?php echo $user_res1['qty']; ?></h6>
            <?php } ?>

            <?php echo $expiretext; ?>
            <h6 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>
        </div>
    </div>
    <?php

		}
	} else {
		echo "   Not Found Any Products..";
	}

	?>
</div>