Mini Shell

Direktori : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/new/sp/admin/
Upload File :
Current File : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/new/sp/admin/search_ac.php

<?php
include '../db/database.php';
$academic = $_GET['itemname'];
if(empty($academic)){
	$sql = "SELECT * FROM teacher AS t1 INNER JOIN title_name AS t2 ON (t1.titleID = t2.titleID) where academic LIKE '%{$academic}%'AND academic > '0'";
}else{
    $sql = "SELECT * FROM teacher AS t1 INNER JOIN title_name AS t2 ON (t1.titleID = t2.titleID) where academic = '$academic' ";
}

$query = mysqli_query($link,$sql);
?>

  <?php 
          $rows = 2;           
          $row = mysqli_num_rows($query);
          $total_page = ceil($row/$rows);
          if(empty($_GET['page'])){ 
              $page=1;
          } else {
              $page=$_GET['page'];
            }  
          if($page>=$total_page) $page=$total_page; 
          $start=($page-1)*$rows;
          
    if(empty($academic)){
	$sql2 = "SELECT * FROM teacher AS t1 INNER JOIN title_name AS t2 ON (t1.titleID = t2.titleID) where academic LIKE '%{$academic}%'AND academic > '0' order By teacherID DESC Limit $start,$rows";
   }else{
    $sql2 = "SELECT * FROM teacher AS t1 INNER JOIN title_name AS t2 ON (t1.titleID = t2.titleID) where academic = '$academic' order By teacherID DESC Limit $start,$rows ";
   }
     $query = mysqli_query($link, $sql2);  
     
      ?>
<div class="container">
<div class="col-md-8 col-md-offset-2">
<div  class="table-responsive">
    <table align="center"id="mytable" class="table table-hover table-bordered">
        <thead class="bg-primary">
            <tr>
                <th>ลำดับ</th>
                <th>ชื่อ-นามสกุล</th>
                <th>วิทยะฐานะ</th>
         
               
            </tr>
        </thead>
        <tbody>
            <?php 
            $i=1;
          if($page > 1)
            {
	    $i = ($rows * ($page-1)) + 1; 
            }
             if(!empty($row)){
            while ($result = mysqli_fetch_assoc($query)) { ?>
            <tr>
                <td><?php echo $i;?></td>
                <td><?php echo $result['titleName']. $result['name']." ". $result['lastName'];?></td>
                <td><?php echo $result['academic'];?></td>              
            </tr>
            <?php $i++; } ?>
            <?php  
        }else if(empty($row)){ 
            ?>
       <tr>
        <td colspan="4"><div align="center"><i class="fa fa-folder-open"></i>&nbsp;ไม่พบข้อมูล</div></td>  
        </tr>
     <?php  }  ?>
        </tbody>
    </table>
     <nav aria-label="Page navigation">
 <div class="text-center">
  <ul class="pagination">
   <li>
      <a aria-label="Previous">
       ทั้งหมด <span class="badge"><?php echo $row;?></span> รายการ
      </a>
    </li>     
    <li <?php if($page==1)echo'class="disabled"';  ?>>
        <a href="academic_report1.php?itemname=<?php echo $academic ?>&page=<?php echo $page-1; ?>"aria-label="Previous">&laquo;  ก่อนหน้า
      </a>
    </li>
    <?php  for($i=1;$i<=$total_page;$i++) {
        if($page-2>=2 and ($i>2and$i<$page-2)){
            echo "<li><a href=>...</a></li>";
            $i=$page-2;
        }
        if($page+5<=$total_page and ($i>=$page+3 and $i<=$total_page-2)){
            echo "<li><a href=>...</a></li>";
            $i=$total_page-1;
        }
    ?>
    <li <?php if($page==$i)echo'class="active"';  ?>><a href="academic_report1.php?itemname=<?php echo $academic ?>&page=<?php echo $i; ?>"> <?php echo $i;?></a></li>
    <?php } ?>
    <li <?php if($page==$total_page)echo'class="disabled"';  ?>>
      <a href="search_ac.php?itemname=<?php echo $academic ?>&page=<?php echo $page+1; ?>"aria-label="Previous"> ถัดไป  &raquo;
      </a>
    </li>
  </ul>
</div>
</nav> 
</div>
</div>
</div>
 

Zerion Mini Shell 1.0