Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo "<html lang='en'>";
- echo "<head>";
- echo "<meta charset='utf-8'>";
- echo "<meta name='viewport' content='width=device-width, initial-scale=1'>";
- echo "<link rel='stylesheet' href='css/bootstrap.min.css'>";
- echo "<script src='js/jquery-3.3.1.min.js'></script>";
- echo "<script src='js/popper.min.js'></script>";
- echo "<script src='js/bootstrap.min.js'></script>";
- echo "</head>";
- echo "<body>";
- echo "<div class='container'>";
- echo "<h2>Tabel Data Komputer</h2>";
- $servername = "localhost";
- $username = "root";
- $password = "";
- $database = "latihan";
- $koneksi = new mysqli($servername,$username,$password,$database);
- $kueri = "SELECT * FROM komputer";
- $hasil = $koneksi->query($kueri);
- /* while($baris = mysqli_fetch_array($hasil)) {
- $kodebarang = $baris['kodebarang'];
- $namahost = $baris['hostname'];
- $alamatip = $baris['ipaddress'];
- $alamatmac = $baris['macaddress']; */
- echo "<table class='table'>";
- echo "<thead>";
- echo "<tr>";
- echo "<th>Kode Barang</th>";
- echo "<th>Nama Host</th>";
- echo "<th>Alamat IP</th>";
- echo "<th>Alamat Mac</th>";
- echo "</tr>";
- echo "</thead>";
- while($baris = mysqli_fetch_array($hasil)) {
- $kodebarang = $baris['kodebarang'];
- $namahost = $baris['hostname'];
- $alamatip = $baris['ipaddress'];
- $alamatmac = $baris['macaddress'];
- echo "<tbody>";
- echo "<tr>";
- echo "<td>".$kodebarang."</td>";
- echo "<td>".$namahost."</td>";
- echo "<td>".$alamatip."</td>";
- echo "<td>".$alamatmac."</td>";
- echo "</tr>";
- echo "</tbody>";
- }
- echo "</div>";
- echo "</body>";
- echo "</html>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement