Advertisement
mikroavr

view_mysql

Mar 3rd, 2019
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.86 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4. <head>
  5.     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  6.     <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
  7.     <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
  8.     <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
  9. </head>
  10. <?php
  11.  
  12.  $server = "localhost";
  13.  $username = "your_username";
  14.  $password = "your_pass";
  15.  $database = "your_database";
  16.  
  17.  $koneksi = mysqli_connect($server,$username,$password,$database) or die("koneksi database gagal");
  18.  
  19. $query = "SELECT * FROM current";
  20. $result = mysqli_query($koneksi, $query);
  21.  
  22. ?>
  23.  
  24. <table class="table">
  25.     <thead class="thead-dark">
  26.         <tr>
  27.             <th scope="col">tanggal</th>
  28.             <th scope="col">current1</th>
  29.             <th scope="col">current2</th>
  30.             <th scope="col">current3</th>
  31.         </tr>
  32.     </thead>
  33.     <tbody>
  34.         <?php
  35.               while ($row = mysqli_fetch_assoc($result)) {
  36.         ?>
  37.             <tr>
  38.                 <td><?php echo $row["tanggal"];?></td>
  39.                 <td><?php echo $row["current1"];?></td>
  40.                 <td><?php echo $row["current1"];?></td>
  41.                 <td><?php echo $row["current1"];?></td>
  42.             </tr>
  43.         <?php
  44.         }
  45.         ?>
  46.     </tbody>
  47. </table>
  48.  
  49. </body>
  50. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement