Dynamic Blinkie Text Generator at TextSpace.net

Feedburner

I heart FeedBurner

Selasa, 15 Mei 2018

Pagination Data di Sql Server 2008 dengan PHP

Contoh Script :
<html>
<head>
    <?php include "koneksiyt.php"; ?>
<title>HD Desktop Walpaper</title>   
<link rel="icon" href="ico.png" type="image/x-icon">
  <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

<link rel="stylesheet" type="text/css" href="style.css">
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link rel="stylesheet" type="text/css" href="style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <script src='//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' type='text/javascript'></script>
  <script type="text/javascript" src="light.js"></script>
    <link rel="stylesheet" type="text/css" href="pop-light.css" media="screen" />

    <body>

<div class="nav-1">
<div class="container" style="border-radius:0px;border:0px solid #000;width:930px;">
    <a href="#"><li class="b-nav-font">Anime</li></a>
    <a href="#"><li class="b-nav-font">Challenge</li></a>
    <a href="#"><li class="b-nav-font">Bokeh</li></a>
    <a href="#"><li class="b-nav-font">Animal</li></a>
    <a href="#"><li class="b-nav-font">Story</li></a>
    <a href="#"><li class="b-nav-font">Emoticon Human</li></a>
    <a href="#"><li class="b-nav-font">Funny</li></a>
    <a href="#"><li class="b-nav-font">Animation 2D</li></a>
    <a href="#"><li class="b-nav-font">Animation 3D</li></a>
</li>

</div>
</div>
<div class="header-homepage-img">
<div class="container" style="">
    <div style="text-align: center;">
    <h2>Hello There</h2>   
    <div style="text-align: center;color:#fff;">Are you ready to search for Walpets that you want and quality with a clear free here?

<p style="margin-top:20px;"><button class="button-st">Let's For Start</button></p>

</div>
</div>
</div>
</div>
<div class="container" style="border:1px solid #000;margin-top:30px;">
    <center><div style="color:#000;font-size:34px;font-weight:bold;">Search Now</div>
Just click and do the image save option very easily. And the image you want is ready to be saved.<p>        </center>
<div class="container"style="text-align:center;margin: auto;border:1px solid #000;width:100%;padding:10px;margin-bottom:20px;">
<?php

    $page = (isset($_GET['page']))? $_GET['page'] : 1;
    $limit =12;
    $limit_start = ($page - 1) * $limit;
  $no = 1;  $cari =
$_POST['cari'];
//$sql = ("SELECT * FROM wp where gambar_link like '%$cari%' or ukuran_gambar like '%$cari%' or link_download like '%$cari%' or keterangan like  '%$cari%' or ket_span like '%$cari%' order by id DESC limit".$limit_start.",".$limit);
$sql = ("Select TOP $limit *
From wp
where id NOT IN
(
Select TOP $limit_start id
From wp
) ");

 $hasil = sqlsrv_query ($conn_p,$sql);   while ($data = sqlsrv_fetch_array ($hasil)){


?> 


   
<div class="for-img-cont">
<div  class='thumbnail'    >
    <?php echo "<img  class='for-place-img-wp' src='wp-img/".$data['gambar_link']."'><span><img class='for-place-img-wp'  src='wp-img/".$data['gambar_link']."'>
    <i style='font-size:12px;'>".$data['ukuran_gambar']."</i><br> <b>".$data['keterangan']."</b> <br>  ".$data['ket_span']."
<a href='#22'><button class='bt-download'>Download</button></a> </span></div>"; ?>

               <!--Keterangan box luar-->
    <div class='keterangan'><b><?php echo $data['keterangan'];?></b></div>
   

</div>
<?php
}
?>
<!-- LINK FIRST AND PREV -->        <?php        if($page == 1 or $page >1){
         ?> 
 </div> 
 <div class="pagination">             
<!--<li class="disabled"><a href="#">First</a></li>!-->        
<!-- <li class="disabled"><a href="#">&laquo;</a></li>!-->       
 <?php                
     $link_prev = ($page > 1)? $page - 1 : 1;        ?>        
  <li><a href="index.php?page=1">First</a></li>        
   <li><a href="index.php?page=<?php echo $link_prev; ?>">&laquo;</a></li>        <?php        }        ?>                <!-- LINK NUMBER -->      
    <?php              
     $sql2 = ("SELECT COUNT(id) AS jumlah FROM wp");
      $query = sqlsrv_query ($conn_p,$sql2); 

    //$get_jumlah = $query->fetch; 
    $get_jumlah = sqlsrv_fetch_array($query);               
    $jumlah_page = ceil($get_jumlah['jumlah'] / $limit);       
       //echo $jumlah_page;
     $jumlah_number = 3;
          $start_number = ($page > $jumlah_number)? $page - $jumlah_number : 1;
          $end_number = ($page < ($jumlah_page - $jumlah_number))? $page + $jumlah_number : $jumlah_page;
                             for($i = $start_number; $i <= $end_number; $i++){          $link_active = ($page == $i)? "" : '';        ?>        
                              <li><?php echo $link_active; ?><a href="index.php?page=<?php echo $i; ?>"><?php echo $i; ?></a></li>        <?php        }        ?>                <!-- LINK NEXT AND LAST -->       
                              <?php                 if($page == $jumlah_page){ // Jika page terakhir        ?>         
                              <li class="disabled"><a href="#">&raquo;</a></li>         
                              <li class="disabled"><a href="#">Last</a></li>       
                              <?php        }else{           $link_next = ($page < $jumlah_page)? $page + 1 : $jumlah_page;        ?>        
                               <li><a href="index.php?page=<?php echo $link_next; ?>">&raquo;</a></li>         
<li><a href="index.php?page=<?php echo $jumlah_page; ?>">Last</a></li>        <?php        }        ?>
</div>   
</div>
<div class="foot">
    <div class="foot-all">
        Copyright &copy; 2018
    </div>
</div>

    </body>
</head>
</html>  <script type="text/javascript">
  $(function() {
    $('#gallery a').lightBox();
  });
  </script>

Tidak ada komentar:

Posting Komentar