Advertisement
Guest User

Untitled

a guest
Apr 26th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. <?php
  2.  
  3. include "header.php";
  4. include "db/koneksi.php";
  5.  
  6. ?>
  7.  
  8.  
  9. <?php
  10.  
  11.  
  12. if (!empty($_GET['message']) && $_GET['message'] == 'success') {
  13. echo '<div class="list"><center><h3>Berhasil meng-update data!</h3></div></center>';
  14. }
  15. ?>
  16.  
  17. <?php
  18. $BatasAwal = 50;
  19. if (!empty($_GET['page'])) {
  20. $hal = $_GET['page'] - 1;
  21. $MulaiAwal = $BatasAwal * $hal;
  22. } else if (!empty($_GET['page']) and $_GET['page'] == 1) {
  23. $MulaiAwal = 0;
  24. } else if (empty($_GET['page'])) {
  25. $MulaiAwal = 0;
  26. }//tampil data
  27. $query = mysql_query("SELECT * FROM users LIMIT $MulaiAwal , $BatasAwal");
  28. ?><h2>Data Pengguna </h2>
  29. <table class="table table-striped table-bordered">
  30. <thead>
  31. <tr>
  32. <th>No</th>
  33. <th>Username</th>
  34. <th>Password</th>
  35. <th>Saldo</th>
  36. <th>Level</th>
  37. <td><b>Opsi</b></td>
  38. </tr>
  39. </thead>
  40. <tbody>
  41. <?php
  42.  
  43. $no = 1;
  44. while ($data = mysql_fetch_array($query)) {
  45. $username = $data['username'];
  46. $balance = $data['balance'];
  47. $role = $data['role'];
  48. $pass = $data['password'];
  49. ?>
  50. <tr>
  51. <td><?php echo"$no";?></td>
  52. <td><?php echo"$username";?></td>
  53. <td><?php echo"$pass";?></td>
  54. <td><?php echo"$balance";?></td>
  55. <td><?php echo"$role";?></td>
  56. <td>
  57. <center><a href="Edit.php?id=<?php echo $data['id']; ?>">Edit</a> </center>
  58. </td>
  59.  
  60. </tr>
  61. <?php
  62. $no++;
  63. }
  64. ?>
  65. </tbody>
  66. </table><?php
  67. $cekQuery = mysql_query("SELECT * FROM users order by id");
  68. $jumlahData = mysql_num_rows($cekQuery);
  69. if ($jumlahData > $BatasAwal) {
  70. echo '<br/><center><div style="font-size:10pt;">Page : ';
  71. $a = explode(".", $jumlahData / $BatasAwal);
  72. $b = $a[0];
  73. $c = $b + 1;
  74. for ($i = 1; $i <= $c; $i++) {
  75. echo '<a style="text-decoration:none;';
  76. if ($_GET['page'] == $i) {
  77. echo 'color:red';
  78. }
  79. echo '" href="?page=' . $i . '">' . $i . '</a> > ';
  80. }
  81. echo '</div></center></div></div></div></center>';
  82.  
  83.  
  84. }
  85. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement