if(isset($_POST['lihat'])){
if($kelas=="" || $semester=="" || $mata_pelajaran==""){ ?>
<script type="text/javascript"> alert( "Pilih Dengan Benar");</script>
<?php }
else {
include_once ('connections/connectdb.php');
$query = mysql_query("SELECT * FROM data_nilai WHERE semester LIKE '%$semester%' AND nama_pelajaran LIKE '%$mata_pelajaran%' ");}
while (@$data = mysql_fetch_assoc($query)){?>
<tr>
<td> <?php echo $data['nama_siswa']?> </td>
<td> <?php echo $data['nilai_uh1'] ?></td>
<td> <?php echo $data['nilai_uh2']?></td>
<td> <?php echo $data['nilai_uh3']?></td>
<td> <?php echo $data['nilai_uts']?></td>
<td> <?php echo $data['nilai_uas']?></td>
<td> <?php echo $data['keterangan']?></td>
<td width="30" align="center"><a href="?page=edit_nilai&kode=<?php echo $data['id_nilai'];?>">Edit</a></td>
</td>
</tr>
<?php } }?>
<form method="post" action="?page=tmahasiswa">
<div class="form-group">
<label >Tahun Angkatan</label>
<select name="angkatan" class="form-control">
<option value="">Pilih Angkatan</option>
<?php
$hasil1 = $mysqli->query("SELECT * FROM angkatan");
while ($r=$hasil1->fetch_assoc()) {
echo "<option value='$r[id_angkatan]'>$r[nm_angkatan]</option> ";
}
?>
</select>
</div>
<div class="form-group">
<label >Jurusan</label>
<select name="jrs" class="form-control">
<option value="">Pilih Jurusan</option>
<?php
$hasil = $mysqli->query("SELECT * FROM jurusan");
while ($r=$hasil->fetch_assoc()) {
echo "<option value='$r[id_jurusan]'>$r[nm_jurusan]</option> ";
}
?>
</select>
</div>
<div class="form-group">
</div>
<div>
<input type="submit" value="Tampilkan Data" name="cari" class="btn btn-info"></input>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-10">
<div class="panel panel-primary">
<!-- Default panel contents -->
<div class="panel-heading"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> Tabel Mahasiswa</div>
<div class="panel-body">
<div class="table-responsive">
<table id="tbljurusan" class="table table-bordered table-condensed table-striped table-hover">
<thead>
<tr>
<div class="form-group">
<a class="btn btn-primary btn-md" href="?page=fmahasiswa"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> TAMBAH</a>
</div>
</tr>
<tr>
<td align="center">NO</td>
<td align="center">NIM</td>
<td align="center">NAMA LENGKAP</td>
<td align="center">JENIS KELAMIN</td>
<td align="center">AGAMA</td>
<td align="center">ALAMAT</td>
<td align="center">TEMPAT LAHIR</td>
<td align="center">TANGGAL LAHIR</td>
<td align="center">TAHUN ANGKATAN</td>
<td align="center">JURUSAN</td>
<td align="center">TELEPON</td>
<td align="center">PROVINSI</td>
<td align="center">KOTA</td>
<td align="center">AKSI</td>
</tr>
</thead>
<?php
if (isset($_POST['cari'])) {
$qcari2 = $_POST['jrs'];
$qcari3 = $_POST['angkatan'];
$sql = "SELECT
mahasiswa.id_mhs,
mahasiswa.nm_mhs,
mahasiswa.jk,
mahasiswa.agama,
mahasiswa.alamat,
mahasiswa.tempat_lahir,
mahasiswa.tanggal_lahir,
mahasiswa.tlp,
mahasiswa.provinsi,
mahasiswa.kota,
mahasiswa.foto,
mahasiswa.username,
mahasiswa.password,
jurusan.nm_jurusan,
angkatan.nm_angkatan
FROM
mahasiswa
INNER JOIN jurusan ON mahasiswa.id_jurusan = jurusan.id_jurusan
INNER JOIN angkatan ON mahasiswa.id_angkatan = angkatan.id_angkatan
WHERE nm_jurusan like '%$qcari2%'
OR nm_angkatan like '%$qcari3%'
ORDER BY id_mhs ";
$data = $mysqli->query($sql);
if ($data->num_rows == 0) {
echo "<font color=red>Data yang dicari tidak ditemukan</font>";
}
}
<?php
$dbhost = 'localhost';
$dbuser = 'root'; // ini berlaku di xampp
$dbpass = ''; // ini berlaku di xampp
$dbname = 'buku';
// melakukan koneksi ke database
$connect = new mysqli($dbhost,$dbuser,$dbpass,$dbname);
$sql = "SELECT * FROM `tbl_valve` WHERE `id` LIKE 'A'";
$result = $connect->query($sql);
$row = $result->fetch_assoc();
//header yang menunjukkan nama file yang akan didownload
header('Content-Disposition: attachment; filename="$row[id]"');
//header("Content-Disposition: attachment; filename=".$row['id']);
//header yang menunjukkan jenis file yang akan didownload
header('Content-Type: ".$row[tipe]"');
//header yang menunjukkan ukuran file yang akan didownload
header('Content-Length: ".$row[$size]"');
$fp = fopen("valve/".$row["id"], 'r');
$content = fread($fp, filesize("valve/".$row["id"]));
fclose($fp);
echo $content;
exit;
?>