Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include"../inc/koneksi.php";
- ?>
- <table class="table table-striped table-bordered">
- <tr bgcolor="cccccc">
- <th><center>No.</center></th>
- <th><center>ID kategori</center></th>
- <th><center>Nama kategori</center></th>
- <th><center>Proses</center></th>
- </tr>
- <?php
- include"../inc/koneksi.php";
- $query = mysql_query("SELECT * FROM kategori ORDER BY id_kategori DESC") or die(mysql_error());
- if(mysql_num_rows($query)==0){
- echo'<tr><td colspan="6">Tidak ada Data!</td></tr>';
- }else{
- //pagination
- $per_page = 4;
- $page_query = mysql_query("SELECT COUNT(*) FROM kategori");
- $pages = ceil(mysql_result($page_query, 0) / $per_page);
- $page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
- $start = ($page - 1) * $per_page;
- $query = mysql_query("SELECT * FROM kategori LIMIT $start, $per_page");
- {
- $no=1;
- while($data = mysql_fetch_assoc($query)){
- echo '<tr>';
- echo'<td><center>'.$no.'</center></td>';
- echo'<td><center>'.$data['id_kategori'].'</center></td>';
- echo'<td><center>'.$data['nama_kategori'].'</center></td>';
- echo'<td><center><a class="glyphicon glyphicon-pencil" href="kategori_edit.php?id='.$data['id_kategori'].'"></a> | <a class="glyphicon glyphicon-trash" href="kategori_hapus.php?id='.$data['id_kategori'].'" onclick="return confirm(\'Yakin?\')"></a></td>';
- echo '<tr>';
- $no++;
- }
- }
- ?>
- </table>
- <!--Button Tambah Data-->
- <div class="container">
- <form class="form-horizontal" role"form" action="kategori_tambah.php" method="POST">
- <button type="submit" class="btn btn-primery"><span class="glyphicon glyphicon-plus"></span> Tambah Data</button>
- </form>
- </div>
- <!--pagination-->
- <?php } ?>
- <!--pagination-->
- <hr>
- <center>
- <ul class="pagination pagination-sm">
- <?php
- if($pages >= 1 && $page <= $pages)
- {
- for($x=1; $x<=$pages; $x++)
- {
- //echo ($x == $page) ? '<b><a href="?page='.$x.'">'.$x.'</a></b> ' : '<a href="?page='.$x.'">'.$x.'</a> ';
- if($x == $page)
- echo ' <li class="active"><a href="?page='.$x.'">'.$x.'</a></li>';
- else
- echo ' <li><a href="?page='.$x.'">'.$x.'</a></li>';
- }
- }
- ?>
- </ul>
- </center>
- <!--pagination-->
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement