HOME


Mini Shell 1.0
DIR:/home/rahuldwi/public_html/admin/controls/
Upload File :
Current File : /home/rahuldwi/public_html/admin/controls/categorylist.php



<?php







    include '../connection.php';



 







    $find = @$_POST["find"];  







    $mypage = @$_POST["pageId"];







    if(!empty($mypage)){







        $_SESSION['pageId']=$mypage;







    }else{







        $mypage = @$_SESSION['pageId'];







    }







    //$query2="select * from itemmaster where idesc like '%$find%'order by id asc";







$query2="SELECT * from category";







$res    = $mysqli->query($query2);







$count  = @mysqli_num_rows($res);







$HTML1="<b>Total Records: </b>".$count."<br><br>";







//if($count > 0){







$page = (int) (!isset($mypage) ? 1 :$mypage);















$page = ($page == 0 ? 1 : $page);







$recordsPerPage = 10;







$start = ($page-1) * $recordsPerPage;







$adjacents = "1";







    







$prev = $page - 1;







$next = $page + 1;







$lastpage = ceil($count/$recordsPerPage);







$lpm1 = $lastpage - 1;   







$pagination = "";







if($lastpage > 1)







    {   







        $pagination .= "<div class='pagination'>";







        if ($page > 1)







            $pagination.= "<a  style='cursor:pointer;' onClick='changePagination(".($prev).");'>Prev &nbsp;</a>";







        else







            $pagination.= "<span class='disabled'>Prev &nbsp;</span>";   







        if ($lastpage < 7 + ($adjacents * 2))







        {   







            for ($counter = 1; $counter <= $lastpage; $counter++)







            {







                if ($counter == $page)







                    $pagination.= "<span class='current'>$counter</span>";







                else







                    $pagination.= "<a  style='cursor:pointer;' onClick='changePagination(".($counter).");'>$counter</a>";     







                         







            }







        }







        elseif($lastpage > 5 + ($adjacents * 2))







        {







            if($page < 1 + ($adjacents * 2))







            {







                for($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)







                {







                    if($counter == $page)







                        $pagination.= "<span class='current'>$counter</span>";







                    else







                        $pagination.= "<a  style='cursor:pointer;' onClick='changePagination(".($counter).");'>$counter</a>";     







                }







                $pagination.= "...";







                $pagination.= "<a  style='cursor:pointer;' onClick='changePagination(".($lpm1).");'>$lpm1</a>";







                $pagination.= "<a  style='cursor:pointer;' onClick='changePagination(".($lastpage).");'>$lastpage</a>";   







           







           }







           elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))







           {







               $pagination.= "<a  style='cursor:pointer;' onClick='changePagination(1);'>1</a>";







               $pagination.= "<a  style='cursor:pointer;' onClick='changePagination(2);'>2</a>";







               $pagination.= "...";







               for($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)







               {







                   if($counter == $page)







                       $pagination.= "<span class='current'>$counter</span>";







                   else







                       $pagination.= "<a href=\"#Page=".($counter)."\" onClick='changePagination(".($counter).");'>$counter</a>";     







               }







               $pagination.= "..";







               $pagination.= "<a  style='cursor:pointer;' onClick='changePagination(".($lpm1).");'>$lpm1</a>";







               $pagination.= "<a  style='cursor:pointer;' onClick='changePagination(".($lastpage).");'>$lastpage</a>";   







           }







           else







           {







               $pagination.= "<a  style='cursor:pointer;' onClick='changePagination(1);'>1</a>";







               $pagination.= "<a  style='cursor:pointer;' onClick='changePagination(2);'>2</a>";







               $pagination.= "..";







               for($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)







               {







                   if($counter == $page)







                        $pagination.= "<span class='current'>$counter</span>";







                   else







                        $pagination.= "<a  style='cursor:pointer;' onClick='changePagination(".($counter).");'>$counter</a>";     







               }







           }







        }







        if($page < $counter - 1)







            $pagination.= "<a  style='cursor:pointer;' onClick='changePagination(".($next).");'>Next &raquo;</a>";







        else







            $pagination.= "<span class='disabled'>Next &raquo;</span>";







        







        $pagination.= "</div>";       







    }







    







if(isset($_POST['pageId']) && !empty($_POST['pageId']))







{







    $id=$_POST['pageId'];







}







else







{







    $id='0';







}





$query="SELECT * from category order by id desc limit ".$start.",$recordsPerPage";

$res    =   $mysqli->query($query);

$count  =   @mysqli_num_rows($res);

//echo $count;

//echo $HTML1;

echo "<div>".$HTML1."</div>";

//$HTML=$query;

if($count > 0)

{



    $i=0;

    $type="";

    echo "<table id='dataTableExample1' class='table table-bordered table-striped table-hover'>"

    . "<thead class='info'><tr><th>Name</th><th>Action</th></tr></thead>";

    while($row = $res->fetch_array())

    {          

        if($row["type"]=="1"){



            $type ="LeaderShip";



        }else{



            $type ="Gallery";

        }



                echo "<tr style='border-bottom: 1px solid #cdcdcd;'>"

                   . "<td>".$row['name']."</td>"

                  

                  ."<td><a href='category.php?id=".$row["id"]."' class='btn btn-add btn-sm' ><i class='fa fa-pencil'></i></a>

                    <a onclick='DeleteIt(".$row["id"].");' class='btn btn-danger btn-sm'><i class='fa fa-trash-o'></i> </a></td>"              



                . "</tr>";

          

    }



    echo "</table>";

    

}



else

{



   $HTML1.='No Items Found';



}



echo "<BR><div class='clearfix'></div><div style='min-width: 450px;text-align:left;margin-top:20px;margin-bottom:10px;'>".$pagination."</div><br>";



echo '<br><br>

 <div class="clearfix"></div><br><br>';



?>