SHARE
TWEET

PHP 7 : Membuat Form Bootstrap 30 Juli 2018

stevennathaniel Jul 29th, 2018 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. echo "<html lang='en'>";
  4.  
  5.     echo "<head>";
  6.  
  7.         echo "<meta charset='utf-8'>";
  8.  
  9.         echo "<meta name='viewport' content='width=device-width, initial-scale=1'>";
  10.  
  11.         echo "<link rel='stylesheet' href='css/bootstrap.min.css'>";
  12.  
  13.         echo "<script src='js/jquery-3.3.1.min.js'></script>";
  14.  
  15.         echo "<script src='js/popper.min.js'></script>";
  16.  
  17.         echo "<script src='js/bootstrap.min.js'></script>";
  18.  
  19.  
  20.     echo "</head>";
  21.  
  22.  
  23.     echo "<body>";
  24.  
  25.         echo "<div class='container'>";
  26.  
  27.             echo "<h2>Tabel Data Komputer</h2>";
  28.  
  29.  
  30. $servername = "localhost";
  31.  
  32. $username = "root";
  33.  
  34. $password = "";
  35.  
  36. $database = "latihan";
  37.  
  38. $koneksi = new mysqli($servername,$username,$password,$database);
  39.  
  40. $kueri = "SELECT * FROM komputer";
  41.  
  42. $hasil = $koneksi->query($kueri);
  43.  
  44. /* while($baris = mysqli_fetch_array($hasil)) {
  45.  
  46.     $kodebarang = $baris['kodebarang'];
  47.  
  48.     $namahost = $baris['hostname'];
  49.  
  50.     $alamatip = $baris['ipaddress'];
  51.  
  52.     $alamatmac = $baris['macaddress']; */
  53.  
  54.  
  55.         echo "<table class='table'>";
  56.  
  57.             echo "<thead>";
  58.  
  59.                 echo "<tr>";
  60.  
  61.                     echo "<th>Kode Barang</th>";
  62.  
  63.                     echo "<th>Nama Host</th>";
  64.  
  65.                     echo "<th>Alamat IP</th>";
  66.  
  67.                     echo "<th>Alamat Mac</th>";
  68.  
  69.                 echo "</tr>";
  70.  
  71.             echo "</thead>";
  72.  
  73.             while($baris = mysqli_fetch_array($hasil)) {
  74.  
  75.                 $kodebarang = $baris['kodebarang'];
  76.            
  77.                 $namahost = $baris['hostname'];
  78.            
  79.                 $alamatip = $baris['ipaddress'];
  80.            
  81.                 $alamatmac = $baris['macaddress'];
  82.  
  83.  
  84.  
  85.             echo "<tbody>";
  86.  
  87.                 echo "<tr>";
  88.  
  89.                     echo "<td>".$kodebarang."</td>";
  90.  
  91.                     echo "<td>".$namahost."</td>";
  92.  
  93.                     echo "<td>".$alamatip."</td>";
  94.  
  95.                     echo "<td>".$alamatmac."</td>";
  96.  
  97.  
  98.                 echo "</tr>";
  99.             echo "</tbody>";
  100.  
  101.  
  102.  
  103.  
  104. }
  105.  
  106.  
  107. echo "</div>";
  108.  
  109. echo "</body>";
  110.  
  111. echo "</html>";
  112.  
  113.  
  114. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top