Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. <?php
  2. $conDB = new mysqli('nama_host', 'nama_user', 'password', 'nama_db');
  3. ?>
  4.  
  5. <!DOCTYPE html>
  6. <html lang="en">
  7. <head>
  8. <meta charset="UTF-8">
  9. <title>Document</title>
  10. <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
  11. <link rel="stylesheet" href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css" />
  12. </head>
  13. <body>
  14. <table>
  15. <thead>
  16. <tr>
  17. <th>No.</th>
  18. <th>NIM</th>
  19. <th>Nama</th>
  20. </tr>
  21. </thead>
  22. <tbody>
  23. <?php $no = 1; ?>
  24. <?php $tes = $conDB->query("SELECT * FROM nama_tabel"); ?>
  25. <?php while ($row = $tes->fetch_assoc()) : ?>
  26. <tr>
  27. <td><?=$no++;?></td>
  28. <td><?=$row['nim'];?></td>
  29. <td><?=$row['nama'];?></td>
  30. </tr>
  31. <?php endwhile; ?>
  32. </tbody>
  33. </table>
  34. <script src="js/jquery-3.4.1.min.js"></script>
  35. <script src="js/jquery.dataTables.min.js"></script>
  36. <script src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script>
  37. <script>
  38. $(document).ready(function(){
  39. $('#tabel-data').DataTable();
  40. });
  41. </script>
  42. </body>
  43. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement