SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | //memasukkan file config.php | |
| 3 | include('config.php');
| |
| 4 | $mahasiswa = query("SELECT * FROM mahasiswa");
| |
| 5 | ||
| 6 | ||
| 7 | if (isset($_POST["cari"])){
| |
| 8 | $mahasiswa = cari($_POST["keyword"]); | |
| 9 | } | |
| 10 | /* untuk apa $mahasiswa? */ | |
| 11 | ?> | |
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | <div class="container" style="margin-top:20px"> | |
| 16 | <center><font size="6">Data Mahasiswa</font></center> | |
| 17 | <hr> | |
| 18 | <a href="index.php?page=tambah_mhs"><button class="btn btn-dark right">Tambah Data</button></a> | |
| 19 | <form action="" method="post" > | |
| 20 | <button type="submit" name="cari" class="btn btn-dark right">Cari</button> | |
| 21 | <input type="text" name="keyword" class="resizedTextbox"> | |
| 22 | </form> | |
| 23 | ||
| 24 | </div> | |
| 25 | <div class="table-responsive"> | |
| 26 | <table class="table table-striped jambo_table bulk_action"> | |
| 27 | <thead> | |
| 28 | <tr> | |
| 29 | <th>NO.</th> | |
| 30 | <th>NIM</th> | |
| 31 | <th>Nama Mahasiswa</th> | |
| 32 | <th>Jenis Kelamin</th> | |
| 33 | <th>Program Studi</th> | |
| 34 | <th>Pendaftaran</th> | |
| 35 | <th>UKT</th> | |
| 36 | <th>PFK</th> | |
| 37 | <th>Keterangan</th> | |
| 38 | <th>Aksi</th> | |
| 39 | ||
| 40 | </tr> | |
| 41 | </thead> | |
| 42 | <tbody> | |
| 43 | <?php | |
| 44 | //query ke database SELECT tabel mahasiswa urut berdasarkan id yang paling besar | |
| 45 | $sql = mysqli_query($koneksi, "SELECT * FROM mahasiswa ORDER BY Nim DESC") or die(mysqli_error($koneksi)); | |
| 46 | //jika query diatas menghasilkan nilai > 0 maka menjalankan script di bawah if... | |
| 47 | if(mysqli_num_rows($sql) > 0){
| |
| 48 | //membuat variabel $no untuk menyimpan nomor urut | |
| 49 | $no = 1; | |
| 50 | //melakukan perulangan while dengan dari dari query $sql | |
| 51 | while($data = mysqli_fetch_assoc($sql)){
| |
| 52 | //menampilkan data perulangan | |
| 53 | echo ' | |
| 54 | <tr> | |
| 55 | <td>'.$no.'</td> | |
| 56 | <td>'.$data['Nim'].'</td> | |
| 57 | <td>'.$data['Nama_Mhs'].'</td> | |
| 58 | <td>'.$data['Jenis_Kelamin'].'</td> | |
| 59 | <td>'.$data['Program_Studi'].'</td> | |
| 60 | <td>'.$data['pendaftaran'].'</td> | |
| 61 | <td>'.$data['ukt'].'</td> | |
| 62 | <td>'.$data['pfk'].'</td> | |
| 63 | <td>'.$data['keterangan'].'</td> | |
| 64 | <td> | |
| 65 | <a href="cetak.php?page=edit_mhs&Nim='.$data['Nim'].'" class="btn btn-secondary btn-sm">Cetak</a> | |
| 66 | <a href="index.php?page=edit_mhs&Nim='.$data['Nim'].'" class="btn btn-secondary btn-sm">Edit</a> | |
| 67 | </td> | |
| 68 | </tr> | |
| 69 | '; | |
| 70 | $no++; | |
| 71 | } | |
| 72 | - | }else{
|
| 72 | + | |
| 73 | - | echo ' |
| 73 | + | |
| 74 | - | <tr> |
| 74 | + | else |
| 75 | {
| |
| 76 | - | </tr> |
| 76 | + | echo ' <tr> |
| 77 | - | '; |
| 77 | + | |
| 78 | </tr> '; | |
| 79 | } | |
| 80 | ?> | |
| 81 | <tbody> | |
| 82 | </table> | |
| 83 | </div> | |
| 84 | ||
| 85 |