OverLord Shell
<?php
if(isset($_POST['page'])){
//Include pagination class file
include('Pagination.php');
//Include database configuration file
include('dbConfig.php');
$start = !empty($_POST['page'])?$_POST['page']:0;
$limit = 3;
//set conditions for search
$whereSQL = $orderSQL = '';
$keywords = $_POST['keywords'];
$sortBy = $_POST['sortBy'];
if(!empty($keywords)){
$whereSQL = "WHERE usrName LIKE '%".$keywords."%'";
}
if(!empty($sortBy)){
$orderSQL = " ORDER BY usrId ".$sortBy;
}else{
$orderSQL = " ORDER BY usrId DESC ";
}
//get number of rows
$queryNum = $db->query("SELECT COUNT(1) as postNum FROM t_user_profile ".$whereSQL.$orderSQL);
$resultNum = $queryNum->fetch_assoc();
$rowCount = $resultNum['postNum'];
//initialize pagination class
$pagConfig = array(
'currentPage' => $start,
'totalRows' => $rowCount,
'perPage' => $limit,
'link_func' => 'searchFilter'
);
$pagination = new Pagination($pagConfig);
//get rows
$query = $db->query("SELECT * FROM t_user_profile $whereSQL $orderSQL LIMIT $start,$limit");
if($query->num_rows > 0){ ?>
<div class="posts_list">
<?php
while($row = $query->fetch_assoc()){
$postID = $row['usrId'];
?>
<div class="list_item"><a href="javascript:void(0);"><h2><?php echo $row["usrName"]; ?></h2></a></div>
<div class="list_item"><a href="javascript:void(0);"><h2><?php echo $row["usrContact"]; ?></h2></a></div>
<?php } ?>
</div>
<?php echo $pagination->createLinks(); ?>
<?php } } ?>
xRyukZ - Copyright 2k19