OverLord Shell

Path : G:/PleskVhosts/jaincensus.com/macciaweb.ultraliant.com/businessforum/
File Upload :
Current File : G:/PleskVhosts/jaincensus.com/macciaweb.ultraliant.com/businessforum/mysearch.php

<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Ajax Pagination with Search and Filter in PHP by CodexWorld</title>
<link href='style.css' rel='stylesheet' type='text/css'>
<script src="jquery.min.js"></script>
<script>
function searchFilter(page_num) {
    page_num = page_num?page_num:0;
    var keywords = $('#keywords').val();
    var sortBy = $('#sortBy').val();
    $.ajax({
        type: 'POST',
        url: 'getData.php',
        data:'page='+page_num+'&keywords='+keywords+'&sortBy='+sortBy,
        beforeSend: function () {
            $('.loading-overlay').show();
        },
        success: function (html) {
            $('#posts_content').html(html);
            $('.loading-overlay').fadeOut("slow");
        }
    });
}
</script>
</head>
<body>
<h1>Ajax Pagination with Search and Filter in PHP by CodexWorld</h1>
<div class="post-search-panel">
    <input type="text" id="keywords" placeholder="Type keywords to filter posts" onkeyup="searchFilter()"/>
    <select id="sortBy" onchange="searchFilter()">
        <option value="">Sort By</option>
        <option value="asc">Ascending</option>
        <option value="desc">Descending</option>
    </select>
</div>
<div class="post-wrapper">
    <div class="loading-overlay"><div class="overlay-content">Loading.....</div></div>
    <div id="posts_content">
    <?php
    //Include pagination class file
    include('Pagination.php');
    
    //Include database configuration file
    include('dbConfig.php');
    
    $limit = 10;
    
    //get number of rows
    $queryNum = $db->query("SELECT COUNT(1) as postNum FROM busdir_mst_category");
    $resultNum = $queryNum->fetch_assoc();
    $rowCount = $resultNum['postNum'];
    
    //initialize pagination class
    $pagConfig = array(
        'totalRows' => $rowCount,
        'perPage' => $limit,
        'link_func' => 'searchFilter'
    );
    $pagination =  new Pagination($pagConfig);
    
    //get rows
    $query = $db->query("SELECT * FROM busdir_mst_category  LIMIT $limit");
    
    if($query->num_rows > 0){ ?>
        <div class="posts_list">
        <table class="table table-striped table-hover">
        <thead>
            <tr>
                <th>Name</th>
                <th>Contact</th>
            </tr>
        </thead>
        <tbody>
        <?php
            while($row = $query->fetch_assoc()){ 
                $postID = $row['catid'];
        ?>
            <tr>
                <td><?php echo $row["categoryname"]?></td>
                <td><?php echo $row["categoryname"]?></td>
            </tr>
            <!--<div class="list_item"><a href="javascript:void(0);"><h2><?php echo $row["categoryname"]; ?></h2></a></div>
             <div class="list_item"><a href="javascript:void(0);"><h2><?php echo $row["categoryname"]; ?></h2></a></div>-->
        <?php } ?>
        </div>
        <tr>
        <td colspan="2">
        <?php echo $pagination->createLinks(); ?>
        </td></tr>
    <?php } ?>
     </tbody>
    </table>
    </div>
</div>
</body>
</html>

xRyukZ - Copyright 2k19