Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. <?php
  2. //koneksi
  3. include("config/koneksi_db.php");
  4. koneksi();
  5. //sql
  6. $sql = "SELECT * FROM `barang`";
  7. //query db
  8. $data = mysql_query ($sql) or die ("gagal koneksi tabel");
  9. //menampilkan data
  10. ?>
  11. <div class="panel panel-info">
  12. <div class="panel-heading"><a href="?p=tambah_barang"><button type="button" class="btn btn-default btn-xs">Tambah Barang</button></a></div>
  13. <div class="panel-body">
  14.  
  15. <script type="text/javascript">
  16. $(document).ready(function(){
  17.  
  18. $('#listBerkasTable').DataTable(
  19. {"lengthMenu": [[10, 25, 50,100, -1], [10, 25, 50,100, "All"]]} ); });
  20.  
  21.  
  22. </script>
  23. <div class="table-responsive">
  24.  
  25. <table class="table table-hover table-striped table-bordered" id="listBerkasTable">
  26. <thead>
  27. <tr>
  28. <th>Kode Barang</th>
  29. <th>Nama Barang</th>
  30. <th>Jenis Barang</th>
  31. <th>Jumlah</th>
  32. <th>Edit</th>
  33. <th>Delete</th>
  34. </tr>
  35. </thead>
  36. <tbody>
  37. <?php
  38. while ($row = mysql_fetch_array ($data)){
  39. ?>
  40. <tr>
  41. <td>
  42. <?php
  43. echo $row['kode_barang'];
  44. ?>
  45. </td>
  46. <td>
  47. <?php
  48. echo $row['nama_barang'];
  49. ?>
  50. </td>
  51. <td>
  52. <?php
  53.  
  54. $kode=$row['kode_jenis'];
  55. $sql_jenisbarang = "SELECT `jenis`
  56. FROM `jenis_barang`
  57. WHERE `kode_jenis` = '$kode'";
  58. $data_jenisbarang = mysql_query ($sql_jenisbarang) or die ("gagal koneksi tabel");
  59. $tampil_jenisbarang = mysql_fetch_array($data_jenisbarang);
  60. echo $tampil_jenisbarang['jenis'];
  61. ?>
  62. </td>
  63. <td>
  64. <?php
  65. echo $row['jumlah'];
  66. ?>
  67. </td>
  68. <td align="center">
  69. <a href="?p=edit_barang&id=<?php echo $row['kode_barang'];?>"><span class="glyphicon glyphicon-edit"></span></a>
  70. </td>
  71. <td align="center">
  72. <a href="?p=hapus_barang&id=<?php echo $row['kode_barang'];?>"><span class="glyphicon glyphicon-trash"></span></a>
  73. </td>
  74. </tr>
  75. <?php
  76. }
  77. ?>
  78. </tbody>
  79. </table>
  80. </div>
  81. </div>
  82. </div>
  83. <script src="datatables/jquery.dataTables.js"></script>
  84. <script src="datatables/dataTables.bootstrap.js"></script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement