Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- nama file : list_mhs.php
- tgl pembuatan : 01 April 2019
- author : hendi
- fungsi : menampilkan seluruh data mahasiswa di dalam tabel
- */
- $judul = "List Mahasiswa";
- include "koneksi.php";
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title><?php echo $judul; ?></title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
- </head>
- <body>
- <div class="container">
- <h2><?php echo $judul; ?></h2>
- <table class="table table-striped">
- <thead class="thead-dark">
- <tr>
- <th>No</th>
- <th>NIM</th>
- <th>Nama Lengkap</th>
- <th>Jenis Kelamin</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $strSQL = "SELECT * FROM mahasiswa";
- $hasil = mysqli_query($koneksi,$strSQL);
- $i=0;
- while ($baris = mysqli_fetch_assoc($hasil)) {
- $i++;
- ?>
- <tr>
- <td><?php echo $i; ?></td>
- <td><?php echo $baris["nim"]; ?></td>
- <td><?php echo $baris["nama"]; ?></td>
- <td>
- <?php
- $jkel = $baris["jenis_kelamin"];
- $str_jkel = ($jkel == "P" ? "Perempuan" : "Laki-laki");
- echo $str_jkel;
- ?>
- </td>
- </tr>
- <?php
- }
- ?>
- </tbody>
- </table>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement