ada pun scriptnya :
<?php require_once('Connections/koneksi.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_search = 5;
$pageNum_search = 0;
$urut = 0;
if (isset($_GET['pageNum_search'])) {
$pageNum_search = $_GET['pageNum_search'];
}
$startRow_search = $pageNum_search * $maxRows_search;
$colname_search = "-1";
if (isset($_GET['item1'])) {
$colname_search = $_GET['item1'];
}
$colname2_search = "-1";
if (isset($_GET['item2'])) {
$colname2_search = $_GET['item2'];
}
$colname3_search = "-1";
if (isset($_GET['item3'])) {
$colname3_search = $_GET['item3'];
}
$colname4_search = "-1";
if (isset($_GET['item4'])) {
$colname4_search = $_GET['item4'];
}
mysql_select_db($database_koneksi, $koneksi);
$query_search = sprintf("SELECT * FROM tbl_identitas WHERE nama LIKE %s AND prodi LIKE %s AND ujian LIKE %s ORDER BY `perusahaan kerja` ASC", GetSQLValueString("%" . $colname_search . "%", "text"),GetSQLValueString("%" . $colname2_search . "%", "text"),GetSQLValueString("%" . $colname3_search . "%", "text"),GetSQLValueString("%" . $colname4_search . "%", "text"));
$search = mysql_query($query_search, $koneksi) or die(mysql_error());
$row_search = mysql_fetch_assoc($search);
$totalRows_search = mysql_num_rows($search);
$queryString_search = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_search") == false &&
stristr($param, "totalRows_search") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_search = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_search = sprintf("&totalRows_search=%d%s", $totalRows_search, $queryString_search);
?>
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PMB ~ Search</title>
<link href="jquery-mobile/jquery.mobile-1.0.min.css" rel="stylesheet" type="text/css">
<script src="jquery-mobile/jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="jquery-mobile/jquery.mobile-1.0.min.js" type="text/javascript"></script>
</head>
<body>
<div data-role="page" id="page">
<div data-role="header" align="center">
<a href="index.php" data-icon="home">Home</a>
<h2>PENERIMAAN CALON MAHASISWA BARU</h2>
<h1>STT IBNU SINA BATAM</h1>
<a href="list.php" data-icon="star">List</a>
</div>
<div data-role="content" align="center">
<h1> DATA PENDAFTARAN </h1>
<h1> <p>MAHASISWA BARU</p> </h1>
<form name="form1" method="GET" action="">
<label for="item1">NAMA MAHASISWA</label><input type="text" name="item1" id="item1">
<select name="item2" size="1">
<option value="">PROGRAM STUDI</option>
<option value="informatika">TEKNIK INFORMATIKA</option>
<option value="industri">TEKNIK INDUSTRI</option>
</select>
<select name="item3" size="1">
<option value="">JENIS KELAMIN</option>
<option value="wanita">PEREMPUAN</option>
<option value="pria">LAKI-LAKI</option>
</select>
<select name="item4" size="1">
<option value="">STATUS UJIAN</option>
<option value="lulus">LULUS</option>
<option value="tidak lulus">TIDAK LULUS</option>
<option value="belum ujian">BELUM UJIAN</option>
<option value="interview">LULUS TES ONLINE DAN INTERVIEW</option>
</select>
<input type="submit" value="SEARCH" />
</form>
<?php
$ketemu=$totalRows_search;
if ($ketemu>0)
{ ?>
<h1>HASIL PENCARIAN DATA</h1>
<p>JUMLAH DATA DITEMUKAN : <?php print $totalRows_search ?></p><br/>
<table border="2" cellpadding="1" cellspacing="1">
<tr>
<th>NO</th>
<th>NAMA</th>
<th>GELOMBANG</th>
<th>PERUSAHAAN KERJA</th>
<th>PRODI</th>
<th>STATUS UJIAN</th>
</tr>
<?php do { ?>
<tr>
<td><?php $urut=$urut+1;$nourut=($pageNum_search*$maxRows_list)+$urut;echo $nourut; ?></td>
<td><?php echo $row_search['nama']; ?></td>
<td><?php echo $row_search['gelombang']; ?></td>
<td><?php echo $row_search['perusahaan kerja']; ?></td>
<td><?php echo $row_search['prodi']; ?></td>
<td><?php echo $row_search['ujian']; ?></td>
</tr>
<?php } while ($row_search = mysql_fetch_assoc($search)); ?>
</table>
<table border="0">
<tr>
<td><?php if ($pageNum_search > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_search=%d%s", $currentPage, 0, $queryString_search); ?>">First</a>
<?php } // Show if not first page ?></td>
<td><?php if ($pageNum_search > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_search=%d%s", $currentPage, max(0, $pageNum_search - 1), $queryString_search); ?>">Previous</a>
<?php } // Show if not first page ?></td>
<td><?php if ($pageNum_search < $totalPages_search) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_search=%d%s", $currentPage, min($totalPages_search, $pageNum_search + 1), $queryString_search); ?>">Next</a>
<?php } // Show if not last page ?></td>
<td><?php if ($pageNum_search < $totalPages_search) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_search=%d%s", $currentPage, $totalPages_search, $queryString_search); ?>">Last</a>
<?php } // Show if not last page ?></td>
</tr>
</table>
<?php }
else
{ ?>
<h1>HASIL PENCARIAN DATA</h1>
<p>DATA TIDAK DITEMUKAN</p>
<?php
}
?>
</div>
<?php include "footer.php"; ?>
</div>
</body>
</html><?php
mysql_free_result($search);
?>
Hasilnya Yang Di Tampilkan :
DOSEN MATAKULIAH
Nama : M.Ropianto, M.Kom
NIDN : 1028067804
Status : Dosen Tetap YAPISTA/STT Ibnu Sina
Matakuliah : Pemograman Mobile Lanjutan
Nama : M.Ropianto, M.Kom
NIDN : 1028067804
Status : Dosen Tetap YAPISTA/STT Ibnu Sina
Matakuliah : Pemograman Mobile Lanjutan
No comments:
Post a Comment