CREATE TABLE `jumlah` (
`NIMHS` varchar(10) NOT NULL,
`JUMSKS` varchar(10) NOT NULL,
`JUMMK` varchar(3) NOT NULL,
`KDSEMES` varchar(5) NOT NULL,
`SEMESTER` varchar(13) NOT NULL,
`PRODI` varchar(20) NOT NULL,
`tahun` int(5) NOT NULL,
`tgl` date NOT NULL,
`jam` time NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Dumping data for table `jumlah`
--
INSERT INTO `jumlah` VALUES ('115512345', '9', '3', '3', 'Gasal', 'S1/MANAJEMEN EKONOMI', 2011, '0000-00-00', '00:00:00');
INSERT INTO `jumlah` VALUES ('115501234', '7', '3', '1', 'Gasal', 'S1/MANAJEMEN EKONOMI', 2011, '0000-00-00', '00:00:00');
INSERT INTO `jumlah` VALUES ('AK08', '5', '2', '1', 'Gasal', 'D3/AKUTANSI', 2011, '2011-10-12', '23:00:45');
INSERT INTO `jumlah` VALUES ('115512345', '9', '3', '3', 'Gasal', 'S1/MANAJEMEN EKONOMI', 2012, '2012-10-13', '21:09:33');
<td>Program Studi:</td> <td><select name="PRODI" id="PRODI">
<option value="">-----</option>
<? $kdsem = mysql_query("SELECT *from prodi ");
while($s=mysql_fetch_array($kdsem)){
echo "<option value=$s[KDPRODI]>$s[PRODI]</option>";
}
?> </select></td>
<option></option>
<td>Ganjil/Genap:</td>
<td><select name="SEMESTER" id="SEMESTER">
<option value="">-----</option>
<?
$sem1=mysql_query("select * from smesgangen ");
while ($rs1=mysql_fetch_array($sem1)){
echo "<option value=$rs1[nmgangen]>$rs1[nmgangen]</option>";
}
?> </select>
</td>
<td>Tahun:</td> <td><select name="tahun" id="tahun">
<option value="">-----</option>
<?
$kdtahun = mysql_query("SELECT *from tahun ");
while($r=mysql_fetch_array($kdtahun)){
echo "<option value=$r[idthn]>$r[tahun]</option>";
}
?> </select></td>
$PRODI = $_POST['PRODI'];
$SEMESTER=$_POST['SEMESTER'];
$tahun = $_POST['tahun'];
$sql = "select * from jumlah, mhs where jumlah.PRODI like '%$PRODI%' and jumlah.SEMESTER like '%$SEMESTER%'And jumlah.tahun like '%$tahun%' and mhs.NIMHS=jumlah.NIMHS ";
$PRODI = $_POST['PRODI'];
$SEMESTER=$_POST['SEMESTER'];
$tahun = $_POST['tahun'];
$sql = "select * from jumlah, mhs where jumlah.PRODI like '%$PRODI%' and jumlah.SEMESTER like '%$SEMESTER%'And jumlah.tahun like '%$tahun%' and mhs.NIMHS=jumlah.NIMHS ";
//echo sql
echo $sql;
setelah tahu sql-nya coba jalankan di phpmyadmin, lihat apakah sesuai atau tidak dengan yang kamu harapkan <?php
session_start();
if(isset($_POST['search'])){
include "../config/koneksi.php";
$PRODI = $_POST['PRODI'];
$SEMESTER=$_POST['SEMESTER'];
$tahun = $_POST['tahun'];
$sql = "select * from jumlah, mhs where jumlah.PRODI like '%$PRODI%' and jumlah.SEMESTER like '%$SEMESTER%'
And jumlah.tahun like '%$tahun%' and mhs.NIMHS=jumlah.NIMHS ";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0){
?>
<br/>
<table border="1" width="80%" style="border-collapse:collapse" bordercolor="#999999">
<tr>
<td bgcolor="#999999" >NIM</td>
<td bgcolor="#999999" >NAMA</td>
<td bgcolor="#999999" >JUMMK</td>
<td bgcolor="#999999" >JUMSKS</td>
</tr>
<?php
while($s1 = mysql_fetch_array($result)){?>
<tr>
<td><?php echo $s1['NIMHS'];?></td>
<td><?php echo $s1['NMMHS'];?></td>
<td><?php echo $s1['JUMMK'];?></td>
<td><?php echo $s1['JUMSKS'];?></td>
</tr>
<?php }?></table>
<br>
<table>
<tr> <input type="button" value="kembali" onclick=self.history.back()> </tr>
</table>
<?php
}else{
echo "Maaf, mesin pencarian gagal / tidak menemukan data tersebut. dengan Silahkan coba sekali lagi. Terima kasih.";
echo " <p><input type='button' value='kembali' onclick=self.history.back()>";
} ?>
<table>
<tr><td><a href="javascript:void window.open('http://localhost/krs/admin/cetak_krstot.php?option=com_content&task=view&Itemid=143&pop=1&page=0&prodi=<?php echo $PRODI; ?>&kdsemes=<?php echo $SEMESTER; ?>&thn=<?php echo $tahun; ?>', 'win2', 'status=no,addressbar=yes,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=800,height=800,directories=yes,location=yes'); "
title='Tampil satu halaman untuk dicetak ke printer'><b>[ CETAK ]</b></td></tr>
</table>
<?
}
?>
ini cetak'<?php
session_start();
include "../config/koneksi.php";
?>
<script language="javascript">
<!--
function printed(){
document.getElementById("printtmbl").style.display='none';
window.print();
setTimeout("document.getElementById('printtmbl').style.display='block'",1000);
}
-->
</script>
<body onload="window.print()">
<table width=100%><tr><td><img src="../image/logolap.jpg" ></td></tr>
<tr><td align="left"><b>======================================================================================</b></td></tr>
<tr><td align="center"><b><?php
$PRODI = $_GET['prodi'];
$SEMESTER=$_GET['SEMESTER'];
$tahun = $_GET['tahun'];
$sql1 = mysql_query("select * from jumlah, mhs where
jumlah.PRODI like '%$PRODI%' and
jumlah.SEMESTER like '%$SEMESTER%' And
jumlah.tahun like '%$tahun%' and mhs.NIMHS=jumlah.NIMHS");
$ketemuprodi = mysql_fetch_array($sql1);
echo "Data KRS Mahasiswa <br/>
Program Studi : ".$ketemuprodi['PRODI']." <br/>
Semester/Tahun : ".$ketemuprodi['SEMESTER']." / ".$ketemuprodi['tahun']."<br/>
" ?></b></td></tr></table>
<table border=1 width=100% style="border-collapse:collapse" bordercolor="#999999">
<tr>
<th><b>No</b></th>
<th><b>NIM</b></th>
<th><b>Nama Lengkap</b></th>
<th><b>Jumlah Matakuliah</b></th>
<th><b>Jumlah SKS</b></th>
</tr>
<?php
$sql = "select * from jumlah, mhs where jumlah.PRODI like '%$PRODI%' and jumlah.SEMESTER like '%$SEMESTER%'
And jumlah.tahun like '%$tahun%' and mhs.NIMHS=jumlah.NIMHS ";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0){
$jum = 0;
$i = 1;
while($s1 = mysql_fetch_array($result)){?>
<p><tr>
<td><?php echo $i ;?></td>
<td><?php echo $s1['NIMHS'];?></td>
<td><?php echo $s1['NMMHS'];?></td>
<td align="center"><?php echo $s1['JUMMK'];?></td>
<td align="center"><?php echo $s1['JUMSKS'];?></td>
</tr>
<?php $i++; }?></table>
<?
echo"<table width=\"100%\" border=\"0\" cellspacing=\"\" cellpadding=\"\"> <p>
<tr><td width='60%'><td width='80%'>Kebumen, ".(date("d - m - Y"))."</td></tr>
<tr><td width='60%'><td width='20%'> BAAK,</td></td></tr>
<tr><td> </td></tr>
<tr><td width='25%'>
</td></tr>";
echo "
<tr><td width='25%'>
</td><p>
<td width='25%'>
(____________)
</td></tr></table>
";
?>
<br>
<?php
}else{
}
echo "<br/><tr><td colspan='3' align='center'><span id='printtmbl' onclick=\"printed();\"><a href='#'>Print</a> | <a href='#' onclick='window.close()';>Tutup</a></span></tr></td>";
?>