<?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";
$rname = $_POST["name"];
$refno = $_POST['refno'];
$mobile = $_POST['mobile'];
$email = $_POST['email'];
$city = $_POST['city'];
$status = $_POST['status'];
$state = $_POST['state'];
$type = $_POST['type'];
$amount = $_POST['amount'];
$where="";
if($rname!=""){
$where .="name like '%$rname%' and ";
}
if($refno!=""){
$where .="refby like '%$refno%' and ";
}
if($mobile!=""){
$where .="mobile like '%$mobile%' and ";
}
if($email!=""){
$where .="email like '%$email%' and ";
}
if($city!=""){
$where .="city like '%$city%' and ";
}
if($status=="" || $status=="Any"){
}else{
$where .="status='$status' and ";
}
if($state!=""){
$where .="state like '%$state%' and ";
}
if($amount!=""){
$where .="amount like '%$amount%' and ";
}
$where =substr($where,0,strlen($where)-4);
if(empty($where)){
$query2="SELECT * from member";
}else{
$query2="SELECT * from member where $where";
}
$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 </a>";
else
$pagination.= "<span class='disabled'>Prev </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 »</a>";
else
$pagination.= "<span class='disabled'>Next »</span>";
$pagination.= "</div>";
}
if(isset($_POST['pageId']) && !empty($_POST['pageId']))
{
$id=$_POST['pageId'];
}
else
{
$id='0';
}
if(empty($where)){
$query="SELECT * from member order by id desc limit ".$start.",$recordsPerPage";
}else{
$query="SELECT * from member where $where 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' style='font-size:13px;'>"
. "<thead class='info'><tr><th>Name/Id/Pass</th><th>Email Id/Mobile No</th><th>Date/Address</th><th>City/State</th><th>Pincode/Refby</th><th>Profile Pic</th><th>Adhar Pic</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>Name:".$row['name']."<br>MemberId:".$row["memberid"]."<br>Passowrd:".$row["password"]."<br>Status:".$row["cardstatus"]."</td>"
. "<td>Email Id:".$row['email']."<br>Mobile No".$row['mobile']."</td>"
. "<td>Date:".$row['cdate']."<br>Address:".$row['address']."</td>"
. "<td>City:".$row['city']."<br>State:".$row['state']."</td>"
. "<td>Pincode:".$row['pincode']."<br>Refby:".$row['refby']."</td>"
. "<td><img src='../member/photo/".$row['img']."' style='width:50px;'></td>"
. "<td><img src='../member/photo/".$row['card']."' style='width:50px;'></td>"
."<td><a href='editmember.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>';
?>
|