Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = 'localhost';
- $user = 'root';
- $password = '';
- $database = 'grupo++';
- $link = mysqli_connect($host, $user, $password, $database);
- $sql = "SELECT * FROM usuarios";
- $query = mysqli_query($link, $sql);
- ?>
- <html>
- <head>
- <title>DataTable</title>
- <link rel="stylesheet" href="bootstrap3.37.css">
- <link rel="stylesheet" href="dataTable.css">
- <script src="jquery.js"></script>
- <script src="dataTable.js"></script>
- </head>
- <body>
- <div class="container">
- <table id="example" class="table table-striped display" style="width:100%">
- <thead>
- <tr>
- <th>ID</th>
- <th>NOME</th>
- <th>IDADE</th>
- </tr>
- </thead>
- <tbody>
- <?php
- while ($row = mysqli_fetch_array($query)) {
- ?>
- <tr>
- <td><?php echo $row['id']; ?></td>
- <td><?php echo $row['nome']; ?></td>
- <td><?php echo $row['idade']; ?></td>
- </tr>
- <?php
- }
- ?>
- </tbody>
- <tfoot>
- <tr>
- <th>ID</th>
- <th>NOME</th>
- <th>IDADE</th>
- </tr>
- </tfoot>
- </table>
- </div>
- <script>
- $(document).ready(function() {
- $('#example').DataTable();
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement