<?php 

include "../db.php";

session_start();

if (isset($_POST['start'])) {

    $start= mysqli_real_escape_string($con,$_POST['start']);

    $AndWhere ='';

    if (!empty($_POST['FirstFilterValue']) && empty($_POST['SecondFilterValue'])) {

        $AndWhere = "AND datatitle ='$_POST[FirstFilterValue]'";

    }elseif (empty($_POST['FirstFilterValue']) && !empty($_POST['SecondFilterValue'])) {

        $AndWhere = "";

    }elseif (!empty($_POST['FirstFilterValue']) && !empty($_POST['SecondFilterValue'])) {

         $AndWhere = "AND data_title ='$_POST[FirstFilterValue]'";

    }



    $sql = "SELECT * FROM data WHERE data_catagory = 'service' AND data_up_by = '$_SESSION[uid]' AND data_recycle = '0' $AndWhere ORDER BY data_sl_no DESC LIMIT $start,10";



    $res = mysqli_query($con,$sql);

    if ($total_rows=mysqli_num_rows($res)>0) {

        $s_output='';

        $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-9 col-xs-9'>

                <div class="d-flex justify-content-between align-items-center">

                    <div class="intro-admin">

                        <a style='color:orange;font-size:17px;' class='viewDetails' data-toggle='modal'

                            data-target='#adminDetailsModal'>

                            <i class='fa fa-bell' aria-hidden='true'></i> <b><?php echo $rows["data_title"];?></b>

                        </a>

                    </div>

                </div>

            </div>

            <div class='col-md-3 d-flex justify-content-between'>

                <a href='recycleService.php?view_id=<?php echo $rows["data_sl_no"];?>' class='btn btn-info text-white'

                    title='Click to View'><i class='fa fa-eye' aria-hidden='true'></i>

                </a>

                <br>

                <a href='recycleService.php?edit_id=<?php echo $rows["data_sl_no"];?>' class='btn btn-primary'

                    title='Click to Edit'><i class='fa fa-edit' aria-hidden='true'></i>

                </a>

                <br>

                <a class="btn btn-primary" style="margin-left:5px;"

                    href="recycleService.php?thumbnail_id=<?php echo $rows['data_sl_no']; ?>">Thumbnail</a>

                <br>

                <a href='recycleService.php?rec_id=<?php echo $rows["data_sl_no"];?>' class='btn btn-warning'

                    title='Click to Recycle'><i class='fa fa-recycle' aria-hidden='true'></i> </a>

            </div>

        </div>

    </div>

</li>

<?php

          $c++;

        }

        mysqli_close($con);

    }

}

?>