Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "header.php";
- include "db/koneksi.php";
- ?>
- <?php
- if (!empty($_GET['message']) && $_GET['message'] == 'success') {
- echo '<div class="list"><center><h3>Berhasil meng-update data!</h3></div></center>';
- }
- ?>
- <?php
- $BatasAwal = 50;
- if (!empty($_GET['page'])) {
- $hal = $_GET['page'] - 1;
- $MulaiAwal = $BatasAwal * $hal;
- } else if (!empty($_GET['page']) and $_GET['page'] == 1) {
- $MulaiAwal = 0;
- } else if (empty($_GET['page'])) {
- $MulaiAwal = 0;
- }//tampil data
- $query = mysql_query("SELECT * FROM users LIMIT $MulaiAwal , $BatasAwal");
- ?><h2>Data Pengguna </h2>
- <table class="table table-striped table-bordered">
- <thead>
- <tr>
- <th>No</th>
- <th>Username</th>
- <th>Password</th>
- <th>Saldo</th>
- <th>Level</th>
- <td><b>Opsi</b></td>
- </tr>
- </thead>
- <tbody>
- <?php
- $no = 1;
- while ($data = mysql_fetch_array($query)) {
- $username = $data['username'];
- $balance = $data['balance'];
- $role = $data['role'];
- $pass = $data['password'];
- ?>
- <tr>
- <td><?php echo"$no";?></td>
- <td><?php echo"$username";?></td>
- <td><?php echo"$pass";?></td>
- <td><?php echo"$balance";?></td>
- <td><?php echo"$role";?></td>
- <td>
- <center><a href="Edit.php?id=<?php echo $data['id']; ?>">Edit</a> </center>
- </td>
- </tr>
- <?php
- $no++;
- }
- ?>
- </tbody>
- </table><?php
- $cekQuery = mysql_query("SELECT * FROM users order by id");
- $jumlahData = mysql_num_rows($cekQuery);
- if ($jumlahData > $BatasAwal) {
- echo '<br/><center><div style="font-size:10pt;">Page : ';
- $a = explode(".", $jumlahData / $BatasAwal);
- $b = $a[0];
- $c = $b + 1;
- for ($i = 1; $i <= $c; $i++) {
- echo '<a style="text-decoration:none;';
- if ($_GET['page'] == $i) {
- echo 'color:red';
- }
- echo '" href="?page=' . $i . '">' . $i . '</a> > ';
- }
- echo '</div></center></div></div></div></center>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement