<h4> Kehadiran Mahasiswa/i </h4>
<?php
include "koneksi/koneksi.php";
// ubah ke dalam variabel
$nis = $_GET['nis'];
$nama = $_GET['nama'];
$nama1 = $_GET['nama1'];
//$namas = $_GET['namas'];
// ambil data berdasarkan id siswa yang dimasukkan
//$sql = mysql_query("select * from siswa where nis='$nis'");
$sql = mysql_fetch_array(mysql_query("select * from siswa where nis ='$nis'"));
$id_jr=$sql['id_jr'];
$id_prodis=$sql['id_prodis'];
$sql1 = mysql_fetch_array(mysql_query("select * from jurusan where id_jurus ='$id_jr'"));
$sql2 = mysql_fetch_array(mysql_query("select * from prodi where id_prodi ='$id_prodis'"));
$smith=$sql2['id_prodi'];
//$hasil = mysql_query("SELECT siswa.nis, siswa.namas,siswa.alamat, siswa.hp, jurusan.nama, prodi.nama1 FROM siswa,
// jurusan, prodi WHERE siswa.id_prodis=prodi.id_prodi and siswa.id_jr=jurusan.id_jurus limit $offset,$limit");
// hitung jumlah
?>
<form method=post action=?menu=create_kuliah>
<table border=1>
<tr>
<td> NIS </td>
<td> : </td>
<td><?php echo "$sql[nis]"; ?><input type=hidden name=nis maxlength=20 value="<?php echo "$sql[nis]"; ?>"> </td>
</tr>
<tr>
<td> Nama Siswa </td>
<td> : </td>
<td><?php echo "$sql[namas]"; ?><input type=hidden name=namas maxlength=20 value="<?php echo "$sql[namas]"; ?>"> </td>
</tr>
<tr>
<td> Jurusan </td>
<td> : </td>
<td><?php echo "$sql1[nama]"; ?><input type=hidden name=jurus maxlength=20 value="<?php echo "$sql1[nama]"; ?>"> </td> </tr>
<tr>
<td> Prodi </td>
<td> : </td>
<td><?php echo "$sql2[nama1]"; ?><input type=hidden name=pros maxlength=20 value="<?php echo "$sql2[nama1]"; ?>"> </td> </tr>
</tr>
<tr>
<td colspan=3> <input type=submit value=Simpan> <input type=submit value=Batal onClick=history.back()> </td>
</tr>
</table>
<?php
// panggil semua data dari tabel makul diurutkan berdasarkan id makul, dibatasi dengan limit = 15
//$hasil1= mysql_query("select * from makul1 where hari='$fri'");
include "koneksi/koneksi.php";
$hasil = mysql_query("select * from makul1, pengajar where id_prodi='$smith' and makul1.nip=pengajar.id_pengajar");
$k = 1;
$k = 1 + $offset;
echo"
<div align=left>
<table border=1 width=100%>
<tr>
<th> No. </th>
<th> id makul </th>
<th> makul </th>
<th> SKS </th>
<th> Hari </th>
<th> Jam Tayang </th>
<th> Pengajar </th>
<th width=70> Ambil Mata Kuliah </th>
</tr>
";
while ($data = mysql_fetch_array($hasil)) {
echo"
<tr>
<td width=10 align=center> $k </td>
<td> $data[id_makul] </td>
<td> $data[makul] </td>
<td> $data[sks] </td>
<td> $data[hari] </td>
<td> $data[tayang] </td>
<td> $data[pengajar] </td>
<td align='center'><input type='checkbox' name='item[]' id_makul='item[]' value='$data[id_makul]'>
<td><input type='checkbox' value='".$data['id_makul']."' name='mk".$no."' /> ".$data['namaMK']."<br />
<td> <a href=index.php?menu=edit_makul&id_makul=$data[id_makul] title='Edit makul'> Edit </a> | <a href=index.php?menu=hapus_makul&id_makul=$data[id_makul] title='Hapus makul'> Hapus </a> </td
</tr>
";
$k++;
}
//untuk tutup tabel
//echo "</table>";
//echo "<div class=paging>";
//TES
//echo "</div";
//echo "</font>";
?>
<?php
// uraikan parameter post ke dalam bentuk variabel
include "koneksi/koneksi.php";
$jumlah = count($_POST["item"]);
for($i=0; $i < $jumlah; $i++)
{
$nis = $_POST['nis'];
$namas = $_POST['namas'];
$jurus = $_POST['jurus'];
$pros = $_POST['pros'];
$id_makul = $_POST['id_makul'];
$makul = $_POST['makul'.$i];
$sql = mysql_fetch_array(mysql_query("select * from siswa where nis ='$nis'"));
$id_jr=$sql['id_jr'];
$id_prodis=$sql['id_prodis'];
$sql1 = mysql_fetch_array(mysql_query("select * from jurusan where id_jurus ='$id_jr'"));
$sql2 = mysql_fetch_array(mysql_query("select * from prodi where id_prodi ='$id_prodis'"));
$smith=$sql2['id_prodi'];
$hasil = mysql_query("select * from makul1, pengajar where id_prodi='$smith' and makul1.nip=pengajar.id_pengajar ");
while ($data = mysql_fetch_array($hasil)) {
//$makul = $data[makul];
$sks = $_POST['sks'];
$hari = $_POST['hari'];
$tayang = $_POST['tayang'];
$id_pengajar = $_POST['id_pengajar'];
$pengajar = $_POST['pengajar'];
$id_makul=$_POST["item"][$i];
//$makul=$_POST["item1"][$i];
}
// $q=pg_query("insert into kontra values ('$nim','aktif')");
$q = mysql_query("insert into kontra(nis,nama,jurusan,prodi,id_makul,makul,sks,hari,tayang,id_pengajar,pengajar,status) values('$nis',
'$namas','$jurus','$pros','$id_makul','$makul','$sks','$hari','$tayang','$id_pengajar','$pengajar','kontrak')");
//$masuk = mysql_query("insert into kontra(nis,namas,alamat,hp,id_jr,id_prodis,smi) values('$nis','$nama','$alamat','$hp','$jurusan','$jag1','$smi')");
}
if ($q){
echo"Data Berhasil disimpan";
}
else
{
echo"Data Gagal Disimpan";
}
?>
$query = "SELECT * FROM tpelatihan,tinstruktur WHERE tinstruktur.nip=tpelatihan.nip1 or tinstruktur.nip=tpelatihan.nip2 or tinstruktur.nip=tpelatihan.nip3 or tinstruktur.nip=tpelatihan.nip4 order by kd_plthn LIMIT $offset, $dataperpage";
$result= mysql_query($query) or die ('Error');
<form method="GET" action="">
<div><label for="tgl_awal">Dari Tanggal</label>
<input type="text" id="tgl_awal" name="tgl_awal" readonly="readonly" value="">
<label for="tgl_akhir">Sampai Dengan Tanggal</label>
<input type="text" id="tgl_akhir" name="tgl_akhir" readonly="readonly" value="">
</div><br>
<input type="submit" value="search" name="search">
</form>
<?php
mysql_connect ("localhost", "root", "87654321");
mysql_select_db ("anggota");
$dataPerPage = 10;
if(isset($_GET['page']))
{
$noPage = $_GET['page'];
}
else $noPage = 1;
$offset = ($noPage - 1) * $dataPerPage;
$where = '';
if(isset($_GET['search'])){
$tgl_awal= $_GET['tgl_awal'];
$tgl_akhir= $_GET['tgl_akhir'];
$where .= " WHERE tgl_lulus BETWEEN '$tgl_awal' AND '$tgl_akhir' LIMIT $offset, $dataPerPage";
$where1 .= " WHERE tgl_lulus BETWEEN '$tgl_awal' AND '$tgl_akhir'";
$query = "SELECT * FROM mahasiswa" .$where;
$result = mysql_query($query) or die(mysql_error());}
else {
$where .= " WHERE tgl_lulus = CURDATE() LIMIT $offset, $dataPerPage";
$where1 .= " WHERE tgl_lulus = CURDATE()";
$query = "SELECT * FROM mahasiswa" .$where;
$result = mysql_query($query) or die(mysql_error());}
echo "<table border=1>
<tr>";
echo "<th>Nama</font></th>";
echo "<th>Hobi</font></th>";
echo "<th>Tanggal</font></th>";
echo "</tr>";
while($row1= mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" .$row1['nama']. "</font></td>";
echo "<td>" .$row1['hobi']. "</font></td>";
echo "<td>" .$row1['tgl_lulus']. "</font></td>";
echo "</tr>";}
echo "</table>";
$qp="SELECT Count(*) AS jumData FROM mahasiswa".$where1;
$hasil= mysql_query($qp);
$data = mysql_fetch_array($hasil);
$jumData = $data['jumData'];
$jumPage = ceil($jumData/$dataPerPage);
//bentuk url paramater menggunakan informasi dari $_GET
$params = $_GET;
unset($params['page']);
$urlParam = $params ? '&'.http_build_query($params) : '';
if ($noPage > 1) echo "<a href='".$_SERVER['PHP_SELF']."?page=".($noPage-1).$urlParam."'>Prev</a>";
// memunculkan nomor halaman dan linknya
for($page = 1; $page <= $jumPage; $page++)
{
if ((($page >= $noPage - 3) && ($page <= $noPage + 3)) || ($page == 1) || ($page == $jumPage))
{
if (($showPage == 1) && ($page != 2)) echo "...";
if (($showPage != ($jumPage - 1)) && ($page == $jumPage)) echo "...";
if ($page == $noPage) echo " <b>".$page."</b> ";
else echo " <a href='".$_SERVER['PHP_SELF']."?page=".$page.$urlParam."'>".$page."</a> ";
$showPage = $page;
}
}
// menampilkan link next
if ($noPage < $jumPage) echo "<a href='".$_SERVER['PHP_SELF']."?page=".($noPage+1).$urlParam."'>Next</a>";
?>
<h4> Tambah Mata Kuliah </h4>
<form method=post action=?menu=create_makul1>
<table border=1>
<tr>
<td> ID Makul </td>
<td> : </td>
<td> <input type=text name=id_makul maxlength=10> </td>
</tr>
<tr>
<td> Mata Kuliah </td>
<td> : </td>
<td> <input type=text name=makul maxlength=100> </td>
</tr>
<tr>
<td> Semester </td>
<td> : </td>
<td> <select name="smi">
<option value="I">- I</option>
<option value="II">- II</option>
<option value="III">- III</option>
<option value="IV">- IV</option>
<option value="V">- V</option>
<option value="VI">- VI</option>
<option value="VII">- VII</option>
<option value="VIII">- VIII</option>
</select>
</td>
</td>
</tr>
<tr>
<td> SKS </td>
<td> : </td>
<td> <input type=text name=sks maxlength=100> </td>
</tr>
<tr>
<td> Prodi </td>
<td> : </td>
<td> <select name=id_prodi>
<?php
include "koneksi/koneksi.php";
$sql1 = mysql_query("select * from prodi order by nama1");
while ($data = mysql_fetch_array($sql1)){
//echo "<option value="" selected="selected">- Silahkan Pilih Kota -</option>";
echo "<option value='$data[id_prodi]'> $data[nama1] </option>";
}
?>
</select>
</td>
</tr>
<tr>
<td> Pengajar </td>
<td> : </td>
<td> <select name=id_pengajar>
<?php
include "koneksi/koneksi.php";
$sql1 = mysql_query("select * from pengajar order by pengajar");
while ($data = mysql_fetch_array($sql1)){
//echo "<option value="" selected="selected">- Silahkan Pilih Kota -</option>";
echo "<option value='$data[id_pengajar]'> $data[pengajar] </option>";
}
?>
</select>
</td>
</tr>
<tr>
<td colspan=3> <input type=submit value=Simpan> <input type=submit value=Batal onClick=history.back()> </td>
</tr>
</table>
</form>
<?
include "koneksi/koneksi.php";
$offset=$_GET['offset'];
$totalquery=mysql_query("select * from mak");
$numrows=mysql_num_rows($totalquery);
//jumlah data yang ditampilkan perpage
$limit = 10;
if (empty ($offset)) {
$offset = 0;
}
if ($numrows == 0) {
echo "<br><center> Tidak Ada Data makul </center>";
}
else {
?>
<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="30"">
<div align="left"><font size="3" face="tahoma">Data makul</font><br> Jumlah Data : <?php echo "$numrows" ;?> </div>
</td>
</tr>
</table>
<?php
// panggil semua data dari tabel makul diurutkan berdasarkan id makul, dibatasi dengan limit = 15
$hasil1 = mysql_query("select * from mak, pengajar where pengajar.id_pengajar=mak.id_pengajar limit $offset,$limit");
$k = 1;
$k = 1 + $offset;
echo"
<div align=left>
<table border=1 width=100%>
<tr>
<th> No. </th>
<th> ID Makul </th>
<th> makul </th>
<th> SKS </th>
<th> Pengajar </th>
<th width=70> Aksi </th>
</tr>
";
while ($data = mysql_fetch_array($hasil1)) {
echo"
<tr>
<td width=10 align=center> $k </td>
<td> $data[id_makul] </td>
<td> $data[makul] </td>
<td> $data[sks] </td>
<td> $data[pengajar] </td>
<td> <a href=index.php?menu=edit_makul&id_makul=$data[id_makul] title='Edit makul'> Edit </a> | <a href=index.php?menu=hapus_mak&id_makul=$data[id_makul] title='Hapus makul'> Hapus </a> </td>
</tr>
";
$k++;
}
//untuk tutup tabel
echo "</table>";
echo "<div class=paging>";
if ($offset!=0) {
$prevoffset = $offset-10;
echo "<span class=prevnext> <a href=$PHP_SELF?menu=makul&offset=$prevoffset>Back</a></span>";
}
else {
echo "<span class=disabled>Back</span>";//cetak halaman tanpa link
}
//hitung jumlah halaman
$halaman = intval($numrows/$limit);//Pembulatan
if ($numrows%$limit){
$halaman++;
}
for($i=1;$i<=$halaman;$i++){
$newoffset = $limit * ($i-1);
if($offset!=$newoffset){
echo "<a href=$PHP_SELF?menu=makul&offset=$newoffset>$i</a>";
//cetak halaman
}
else {
echo "<span class=current>".$i."</span>";//cetak halaman tanpa link
}
}
//cek halaman akhir
if(!(($offset/$limit)+1==$halaman) && $halaman !=1){
//jika bukan halaman terakhir maka berikan next
$newoffset = $offset + $limit;
echo "<span class=prevnext><a href=$PHP_SELF?menu=makul&offset=$newoffset>Next</a>";
}
else {
echo "<span class=disabled>Next</span>";//cetak halaman tanpa link
}
}
echo "</div";
echo "</font>";
?>