<?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 sclass='$_POST[FirstFilterValue]'";



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



        $AndWhere = "AND sdate='$_POST[SecondFilterValue]'";



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

        

         $AndWhere = "AND sclass='$_POST[FirstFilterValue]' AND sdate='$_POST[SecondFilterValue]'";

    }





    $sql = "SELECT * FROM class WHERE uploadedby = '$_SESSION[uref]' AND cdisplay='disable' $AndWhere ORDER BY sid 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)) {

            

            $s_output .= 

                "

                <li class='clearfix' style='float: none;'>

                <div class='row'>



                    <div class='col-md-10 col-xs-8 second-item'>

                    <b>Class: </b>  $rows[sclass]

                    <br>

                    <b>Date: </b> <i class='fas fa-clock text-primary'></i> $rows[sdate]

                    </div>

                    <div class='col-md-2 col-xs-4 third-item'>

                    <a href='view-class.php?restore_id=$rows[sid]' class='m-2 btn btn-success btn-sm' sty le='width:35px;'> Restore </a>

                    </div>

                </div>

                </li>

                ";

          $c++;

        }



        mysqli_close($con);



        echo $s_output;

    }



}

?>