Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $conDB = new mysqli('nama_host', 'nama_user', 'password', 'nama_db');
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Document</title>
- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
- <link rel="stylesheet" href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css" />
- </head>
- <body>
- <table>
- <thead>
- <tr>
- <th>No.</th>
- <th>NIM</th>
- <th>Nama</th>
- </tr>
- </thead>
- <tbody>
- <?php $no = 1; ?>
- <?php $tes = $conDB->query("SELECT * FROM nama_tabel"); ?>
- <?php while ($row = $tes->fetch_assoc()) : ?>
- <tr>
- <td><?=$no++;?></td>
- <td><?=$row['nim'];?></td>
- <td><?=$row['nama'];?></td>
- </tr>
- <?php endwhile; ?>
- </tbody>
- </table>
- <script src="js/jquery-3.4.1.min.js"></script>
- <script src="js/jquery.dataTables.min.js"></script>
- <script src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script>
- <script>
- $(document).ready(function(){
- $('#tabel-data').DataTable();
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement