How To Make Automatic pagination for status board program with PHP

I am somewhat confused as to provide a title for my article, but with this title may be sufficient to satisfy our curiosity,


we may never see a television screen in a hospital or other public areas that displays a constantly changing schedule automatically continuously. The information is designed to enable customers or users to obtain the information they need to accurately and quickly. The specified information may include physician schedules, flight schedules, or perhaps the possibility of project schedule our office or our companies need.


to be able to make the program Automatic pagination to the status of some of the program board some of the programs that we need can be downloaded below:

baca juga Apa itu inbound link dan outbound link

1. xampp we can download Here
2. notpad ++ or another programming software

I am here on my blog trying to create using PHP, roughly how ya, we just to the code below:
<?php
include '../modul/koneksi.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>list data PT</title>

    <link href="../css/bootstrap.min.css" rel="stylesheet">
    <link href="../css/bootstrap-responsive.min.css" rel="stylesheet">
    <link href="../css/style.css" rel="stylesheet">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../img/apple-touch-icon-144-precomposed.png">
      <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../img/apple-touch-icon-114-precomposed.png">
      <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../img/apple-touch-icon-72-precomposed.png">
      <link rel="apple-touch-icon-precomposed" href="../img/apple-touch-icon-57-precomposed.png">
      <link rel="shortcut icon" href="../img/favicon.png">

    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script type="text/javascript" src="../js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../js/scripts.js"></script>



    <script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    <?php
    //include('../modul/koneksi.php');
    function ambil_nama(){
    $nama='';
    $sql_nama=mysql_query("select * from t_pt limit 0,20");
    while($data_nama=mysql_fetch_array($sql_nama)){
    $nama.='"'.stripslashes($data_nama['nmpt']).'",';

    }
    return(strrev(substr(strrev($nama),1)));

    }
    ?>

  <script>
  $(function() {
    var DaftarNama = [<?php echo ambil_nama();?> ];
    $( "#text1" ).autocomplete({
      source: DaftarNama
    });
  });
  </script>
    <script type="text/javascript">
        function bantuan() {

        sUrl="fmperusahaan.php"; features = 'toolbar=no, left=350,top=100, ' +
        'directories=no, status=no, menubar=no, ' +
        'scrollbars=no, resizable=no, width=600, height=450';

        window.open(sUrl,"winChild",features);
        }
        var num = id;
        function bantuan2(id) {
   
        sUrl='fmedit.php?id='+ id; features = 'toolbar=no, left=350,top=100, ' +
        'directories=no, status=no, menubar=no, ' +
        'scrollbars=no, resizable=no, width=600, height=450';

        window.open(sUrl,"winChild",features);
        }
        function bantuan3() {

        sUrl="../folderown/phonebook.php"; features = 'toolbar=no, left=350,top=100, ' +
        'directories=no, status=no, menubar=no, ' +
        'scrollbars=no, resizable=no, width=800, height=500';

        window.open(sUrl,"winChild",features);
        }
   
   

    </script>
    <style type="text/css">
   .tooltip {
     display:none;
    position:absolute;
     border:1px solid #333;
     background-color:#161616;
     border-radius:5px;
     padding:10px;
     color:#fff;
     font-size:12px Arial;
    }
       </style>

    <script type='text/javascript'>
         function tanya(nm){
             if(confirm("apakah anda yakin akan menghapus Data ini")){
                 return true;
             }else{
                 return false;
             }
         }

    </script>

    <script type="text/javascript">
        //$(document).ready(function() {
            // Tooltip// only Text
//            $('.masterTooltip').hover(function(){
//                // Hover over code
//                var title = $(this).attr('title');
//                $(this).data('tipText', title).removeAttr('title');
//                $('<p class=".tooltip"></p>')
//                .text(title)
//                .appendTo('body')
//                .fadeIn('slow');
//            }, function() {
//                    // Hover out code
//                $(this).attr('title', $(this).data('tipText'));
//             $('.tooltip').remove();
//                }).mousemove(function(e) {
//                var mousex = e.pageX + 20; //Get X coordinates
//                    var mousey = e.pageY + 10; //Get Y coordinates
//                $('.tooltip')
//        .css({ top: mousey, left: mousex })
//});
//});
//</script>
    <link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>

<body onload="timer=setTimeout('move()',2000)">
<table width="1024" border="0" align="center">
  <tr>
    <td height="111" class="table" align="center"> </td>
  </tr>
  <tr>
    <td>

    </td>
  </tr>
  <tr>
    <td height="322">
    <table class="table">
      <tr tr class="success" height="10">
        <td width="55%" height="59">
        <a href='#' class="masterTooltip" title="TAMBAH" onClick="bantuan()"><font class="btn">TAMBAH PT <i class="icon-plus"></i></font> </a></td>
        <td width="23%"><form id="jkcari" name="jkcari" method="GET" action="">
          <span id="sprytextfield1">
            <input type="text" name="tcari" id="text1" size="5" height="5" width="5" placeholder="Cari Nama Perusahaan"/>
            <span class="textfieldRequiredMsg">Harus ada yang di cari</span></span>
       </td>
        <td width="22%" align="right"><input name="cari" type="submit" class="btn" id="button" value="CARI"/>
        </form></td>
      </tr>
    </table>
      <table class="table">
    <thead>
    <tr valign="top">
        <td width="31" align="center"><div align="center">No</div></td>
        <td width="91" align="center"><div align="center">No. Id PT</div></td>
        <td width="275" align="center"><div align="center">Nama PT</div></td>
        <td width="140" align="center"><div align="center">Nomor Telp 1</div></td>
        <td width="116" align="center"><div align="center">Nomor Telp 2</div></td>
        <td width="140" align="center"><div align="center">Nomor Fax</div></td>
        <td width="100" align="center"><div align="center">Alamat</div></td>
        <td width="56" align="center"><div align="center">Pilih</div></td>
</tr>

<?php
        $cari=$_GET['tcari'];

        $q1 = mysql_query("SELECT count(nmpt) from t_pt");
        $nourut = 1;
        $rsCount = mysql_fetch_array($q1);
        $banyakData = $rsCount[0];
        $page = isset($_GET['page']) ? $_GET['page'] : 1;
        $limit =3;
        $mulai_dari = $limit * ($page - 1);
        $sql_limit = "SELECT  * FROM t_pt  order by nmpt  limit $mulai_dari, $limit";
        $q = mysql_query("SELECT * FROM t_pt where nmpt like '%$cari%' order by nmpt limit $mulai_dari, $limit");
        $hasil = mysql_query($sql_limit);
    //while($data = mysql_fetch_array($hasil)){
        //$q = mysql_query("SELECT * FROM masalah order by Id_masalah asc");

        while($data = mysql_fetch_array($q)){

?>
        <tr class="warning">
                    <td><div align="center"><?php echo $nourut++; ?></td>
                    <td><div align="center"><?php echo $data['idpt']; ?></td>
                    <td><?php echo $data['nmpt']; ?></td>
                    <td><?php echo $data['notelp1pt']; ?></td>
                    <td><?php echo $data['notelp2pt']; ?></td>
                    <td><?php echo $data['nofaxpt']; ?></td>
                   <?php
                        //      $query1="select nama from mm where Idm='".$data['Idm']."'";
                        //      $sql1=  mysql_query($query1);
                        //      while ($hasil = mysql_fetch_array($sql1)){
             ?>
                        <td>
                        <?php //echo $hasil['almt_pt']?>
                        <?php echo $data['almt_pt']; ?></td>
          
                        <script type="text/javascript">
                        var ='<?php echo $data['idpt']?>';
                        </script>
                        <td><a href="#" class="masterTooltip" title="EDIT DATA" onclick="bantuan2(<?php echo $data['idpt']; ?>)">
                                <i class="icon-pencil"></i>
                            </a> |
                            <a href="../folderpt/deletept.php?id=<?php echo $data['idpt']; ?>" onClick='return tanya()' class="masterTooltip" title="HAPUS DATA">
                                <i class="icon-trash"></i>                            </a>                       </td>
        </tr>

   <?php

   }

   ?>
   </tbody>
</table>
      <div class="pagination" align="center">
    <?php

    //membuat pagination
    $banyakHalaman = ceil($banyakData / $limit);
   // echo 'Halaman: ';
    for($i = 1; $i <= $banyakHalaman; $i++){

        if($page != $i){
            echo '<ul><li><a href="pagoto.php?page='.$i.'">'.$i.'</a></li></ul>';
        }else{
            echo '<ul><li><a href="pagoto.php">'.$i.'</a></li></ul>';
        }
    }
   ?>
   </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>

<script type="text/javascript">

var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");

</script>
</body>
</html>

<?php
$banyakHalaman = ceil($banyakData / $limit);
//echo "banyak halaman $banyakHalaman";
//echo"banyak page $page";
for($i = 1; $i <= $banyakHalaman; $i++){
    //echo'<meta http-equiv="refresh" content=5;URL='.$_SERVER['PHP_SELF'].'?page='.$i.'><br/>';
        if($page != $i){
            $i2=$page+1;
            //echo"jumlah $i2";
            if ($i2!=$banyakHalaman+1){
                echo'<meta http-equiv="refresh" content=5;URL='.$_SERVER['PHP_SELF'].'?page='.$i2.'>';
               // echo"jumlah $i2";
            }else{
                echo'<meta http-equiv="refresh" content=5;URL="pagoto.php">';
            }
           //echo "i $i";
           //header('Refresh: 10; URL='.$_SERVER['PHP_SELF'].'?page='.$i);
          // echo "<meta http-equiv='refresh' content='2;url=.$_SERVER["PHP_SELF"]."?page=".$i'>\n";
          //echo '<meta http-equiv="refresh" content="2;url=.$_SERVER['PHP_SELF'].'?page='.$i">';

           //echo".$i.";

        }
        }

?>
Hehehe I was equally confused:>), I am following the most important code that Automatic pagination for the status board can program loops continuously

<?php
$banyakHalaman = ceil($banyakData / $limit);

for($i = 1; $i <= $banyakHalaman; $i++){

        if($page != $i){
            $i2=$page+1;

            if ($i2!=$banyakHalaman+1){
            echo'<meta http-equiv="refresh" content=5;URL='.$_SERVER['PHP_SELF'].'?page='.$i2.'>';

            }else{
                echo'<meta http-equiv="refresh" content=5;URL="pagoto.php">';
            }

        }
        }

?>
here I use meta refresh with content = 5 is to set the time as much as 5 seconds to do refress and URL='.$_SERVER['PHP_SELF'].'?page='.$i2 with url php page with the page that we looping.

baca juga Bagaimana cara Menentukan Grade dengan Bahasa pemrograman Java

so first explanation of my hopefully my explanation on Automatic pagination for board status is understandable heheheh: D

Good luck:>)

Subscribe to receive free email updates:

0 Response to "How To Make Automatic pagination for status board program with PHP"

Post a Comment

Jangan lupa komentar ya