<?php 
include "../db.php";
if (isset($_POST['start'])) {
    $start= mysqli_real_escape_string($con,$_POST['start']);
    $AndWhere ='';
    if (!empty($_POST['FirstFilterValue']) && empty($_POST['SecondFilterValue'])) {
        $AndWhere = "AND cname='$_POST[FirstFilterValue]'";
    }elseif (empty($_POST['FirstFilterValue']) && !empty($_POST['SecondFilterValue'])) {
        $AndWhere = "";
    }elseif (!empty($_POST['FirstFilterValue']) && !empty($_POST['SecondFilterValue'])) {
         $AndWhere = "AND cname='$_POST[FirstFilterValue]'";
    }

    $sql = "SELECT * FROM category WHERE cposition = '1' $AndWhere ORDER BY cid ASC LIMIT $start,10";

    $res = mysqli_query($con,$sql);
    if ($total_rows=mysqli_num_rows($res)>0) {
        $c = $start+1;

        while ($rows=mysqli_fetch_assoc($res)) {
            
            //referance count end//
            ?>
<li class='clearfix' style='float: none;'>
    <div class="single-dis-admin mb-2">
        <div class='row align-items-center'>
            <div class='col-md-11 col-9'>
                <div class="intro-admin">
                    <a style='color:orange;font-size:17px;' class='viewDetails'>
                        <i class='fa fa-list' aria-hidden='true'></i> <b><?php echo $rows["cname"];?></b>
                    </a>
                </div>
            </div>
            <div class='col-md-1 col-3 d-flex'>
                <a href='category.php?edit_id=<?php echo $rows["cid"];?>' class='btn btn-primary btn-sm'
                    title='Click to Edit'><i class='fa fa-edit' aria-hidden='true'></i>
                </a>
                <br>
                <a href='category.php?del_id=<?php echo $rows["cid"];?>' class='delete btn btn-danger btn-sm'
                    title='Click to Delete'><i class='fa fa-trash' aria-hidden='true'></i> </a>
            </div>
        </div>
    </div>
</li>
<?php
          $c++;
        }
        mysqli_close($con);
    }
}
?>