connecting code :
<?php
// Algoritma dan Pemrograman III, By.M.Ropianto, 2015
// Teknik Informatika - STT Ibnu Sina Batam
// Set up koneksi kedatabase sesuai dengan user id dan password aplikasi
define('MYSQL_HOST', 'localhost');
define('MYSQL_USER', 'root');
define('MYSQL_PASS', '');
define('MYSQL_DB', 'mypmb');
// If we fail to connect, we cant keep going, so we exit
$db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS);
//$db=mysql_select_db("csci") or die(mysql_error());
if (!$db)
{
die('<br />Tidak Terhubung KeDatabase "' . MYSQL_HOST . '".');
}
else
{
//echo 'Connected to MySQL server ' . MYSQL_HOST . ' as user ' . MYSQL_USER .
'<br/>';
mysql_select_db(MYSQL_DB);
}
// Calls to MySQL functions go here...
?>
// Algoritma dan Pemrograman III, By.M.Ropianto, 2015
// Teknik Informatika - STT Ibnu Sina Batam
// Set up koneksi kedatabase sesuai dengan user id dan password aplikasi
define('MYSQL_HOST', 'localhost');
define('MYSQL_USER', 'root');
define('MYSQL_PASS', '');
define('MYSQL_DB', 'mypmb');
// If we fail to connect, we cant keep going, so we exit
$db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS);
//$db=mysql_select_db("csci") or die(mysql_error());
if (!$db)
{
die('<br />Tidak Terhubung KeDatabase "' . MYSQL_HOST . '".');
}
else
{
//echo 'Connected to MySQL server ' . MYSQL_HOST . ' as user ' . MYSQL_USER .
'<br/>';
mysql_select_db(MYSQL_DB);
}
// Calls to MySQL functions go here...
?>
index codes :
<?php
include_once('koneksi.php'); //start of search
$a1 = isset($_REQUEST['a1']) ? $_REQUEST['a1'] : '';
$listGel = isset($_POST['listGel']) ? $_POST['listGel'] : '';
$listProd = isset($_POST['listProd']) ? $_POST['listProd'] : '';
$listSUjian = isset($_POST['listSUjian']) ? $_POST['listSUjian'] : '';
if ($a1 == "Search") {
if ($listProd != "" && $listGel != "" && $listSUjian != "") {
$sql = "SELECT * FROM tbl_identitas WHERE gelombang = '$listGel' AND prodi='$listProd' and ujian = '$listSUjian'";
} elseif ($listProd != "" && $listGel != "") {
$sql = "SELECT * FROM tbl_identitas WHERE gelombang = '$listGel' AND prodi='$listProd'";
} elseif ($listProd != "" && $listSUjian != "") {
$sql = "SELECT * FROM tbl_identitas WHERE prodi='$listProd' and ujian = '$listSUjian'";
} elseif ($listGel != "" && $listSUjian != "") {
$sql = "SELECT * FROM tbl_identitas WHERE gelombang = '$listGel' AND ujian = '$listSUjian'";
} elseif ($listGel != "") {
$sql = "SELECT * FROM tbl_identitas WHERE gelombang = '$listGel'";
} elseif ($listProd != "") {
$sql = "SELECT * FROM tbl_identitas WHERE prodi='$listProd'";
} elseif ($listSUjian != "") {
$sql = "SELECT * FROM tbl_identitas WHERE ujian = '$listSUjian'";
} else {
echo 'Please select the options';
}
if (!$q = mysql_query($sql)) {
echo mysql_error();
} elseif (mysql_num_rows($q) == 0) {
echo "<center>Tidak ditemukan!!</center>";
} else {
$tsql = "SELECT FOUND_ROWS() as found";
$qq = mysql_query($tsql);
$rr = mysql_fetch_object($qq);
$found_rows = $rr->found;
$display_result = true;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title> SORTING </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="jqm/jquery.mobile-1.4.5.css" />
<style>
th {
border-bottom: 1px solid #d6d6d6;
}
tr{
background: #e9e9e9;
}
body{
font-family: Helvetica;
}
i{
font-size: 8pt;
}
tr:nth-child(even) {
background: #e9e9e9;
}
</style>
<script type="text/javascript" src="jq/jquery-2.2.0.js"></script>
<script type="text/javascript" src="jqm/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header"><h1><center><b>WELCOME TO SORTINGSITE</b></center></h1></div>
<br />
<br />
<div data-role="content">
<form method="post" name="a1" action="index.php">
<div data-role="fieldcontain">
<div>
<label><b>Gelombang : </b></label>
<select name="listGel" >
<option value="">--Pilih--</option>
<?php
$listQuery = "select gelombang from tbl_identitas group by gelombang";
if ($gel = mysql_query($listQuery)) {
while ($row = mysql_fetch_object($gel)) {
echo "<option value='$row->gelombang'>$row->gelombang</option>";
}
}
?>
</select>
</div>
<br>
<div>
<label><b>Program Studi : </b></label>
<select name="listProd">
<option value="">--Pilih--</option>
<?php
$listQuery = "select prodi from tbl_identitas group by prodi";
if ($gel = mysql_query($listQuery)) {
while ($row = mysql_fetch_object($gel)) {
echo "<option value='$row->prodi'>$row->prodi</option>";
}
}
?>
</select></div>
<br>
<div>
<label><b>Status Ujian : </b></label>
<select name="listSUjian">
<option value="">--Pilih--</option>
<?php
$listQuery = "select ujian from tbl_identitas group by ujian";
if ($gel = mysql_query($listQuery)) {
while ($row = mysql_fetch_object($gel)) {
echo "<option value='$row->ujian'>$row->ujian</option>";
}
}
?>
</select></div>
<br>
<div data-role="button">
<input type="submit" name="a1" align="center" value="Search" />
</div>
</form>
<?php
if (isset($display_result)) {
?>
<br/><br/>
<h3 align="center" id="hasil">Entries Found: <?php echo $found_rows; ?></h3>
<table align="center" data-role="table" class="ui-responsive ui-shadow">
<!--<table align="center" cellpadding="2" cellspacing="0" border="1" >-->
<thead>
<tr>
<th align="center"><font color="black" size="2"><strong>GELOMBANG</strong></font>
</th>
<th align= "center" width="70"><font color="black" size="2"><strong>NAMA</strong></font>
</th>
<th align= "center" width="70"><font color="black" size="2"><strong>NAMA ORANG TUA PEREMPUAN</strong></font>
</th>
<th align= "center" width="70"><font color="black" size="2"><strong>NIK</strong></font>
</th>
<th align= "center" width="70"><font color="black" size="2"><strong>NO TELP</strong></font>
</th>
<th align= "center" width="70"><font color="black" size="2"><strong>EMAIL</strong></font>
</th>
<th align= "center" width="70"><font color="black" size="2"><strong>PRODI</strong></font>
</th>
<th align= "center" width="70"><font color="black" size="2"><strong>STATUS</strong></font>
</th>
<th align= "center" width="70"><font color="black" size="2"><strong>STATUS UJIAN</strong></font>
</th>
</tr>
</thead>
<?php
while ($rs = mysql_fetch_object($q)) {
?>
<tbody>
<tr>
<td><font color="black"><?php echo $rs->gelombang; ?></font>
</td>
<td align='center'><font color="black" ><?php echo $rs->nama; ?></font>
</td>
<td align='center'><font color="black" ><?php echo $rs->n_ibu; ?></font>
</td>
<td align='center'><font color="black"><?php echo $rs->nik; ?></font>
</td>
<td align='center'><font color="black"><?php echo $rs->no_telp; ?></font>
</td>
<td align='center'><font color="black"><?php echo $rs->email; ?></font>
</td>
<td align='center'><font color="black"><?php echo $rs->prodi; ?></font>
</td>
<td align='center'><font color="black"><?php echo $rs->status; ?></font>
</td>
<td align='center'><font color="black"><?php echo $rs->ujian; ?></font>
</td>
</tr>
</tbody>
<?php
}
?>
<?php
while ($r = mysql_fetch_object($q)) {
echo "<tr>
<td align='center'><font color='black' size='2'><b>$r->Nama</b></font>
</td>
</tr>";
}
?>
</table>
<?php
}
?>
</div>
</div>
<div data-role="footer">
<i><center>Copyright Zuliandri © 2016</center></i>
</div>
</body>
</html>
include_once('koneksi.php'); //start of search
$a1 = isset($_REQUEST['a1']) ? $_REQUEST['a1'] : '';
$listGel = isset($_POST['listGel']) ? $_POST['listGel'] : '';
$listProd = isset($_POST['listProd']) ? $_POST['listProd'] : '';
$listSUjian = isset($_POST['listSUjian']) ? $_POST['listSUjian'] : '';
if ($a1 == "Search") {
if ($listProd != "" && $listGel != "" && $listSUjian != "") {
$sql = "SELECT * FROM tbl_identitas WHERE gelombang = '$listGel' AND prodi='$listProd' and ujian = '$listSUjian'";
} elseif ($listProd != "" && $listGel != "") {
$sql = "SELECT * FROM tbl_identitas WHERE gelombang = '$listGel' AND prodi='$listProd'";
} elseif ($listProd != "" && $listSUjian != "") {
$sql = "SELECT * FROM tbl_identitas WHERE prodi='$listProd' and ujian = '$listSUjian'";
} elseif ($listGel != "" && $listSUjian != "") {
$sql = "SELECT * FROM tbl_identitas WHERE gelombang = '$listGel' AND ujian = '$listSUjian'";
} elseif ($listGel != "") {
$sql = "SELECT * FROM tbl_identitas WHERE gelombang = '$listGel'";
} elseif ($listProd != "") {
$sql = "SELECT * FROM tbl_identitas WHERE prodi='$listProd'";
} elseif ($listSUjian != "") {
$sql = "SELECT * FROM tbl_identitas WHERE ujian = '$listSUjian'";
} else {
echo 'Please select the options';
}
if (!$q = mysql_query($sql)) {
echo mysql_error();
} elseif (mysql_num_rows($q) == 0) {
echo "<center>Tidak ditemukan!!</center>";
} else {
$tsql = "SELECT FOUND_ROWS() as found";
$qq = mysql_query($tsql);
$rr = mysql_fetch_object($qq);
$found_rows = $rr->found;
$display_result = true;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title> SORTING </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="jqm/jquery.mobile-1.4.5.css" />
<style>
th {
border-bottom: 1px solid #d6d6d6;
}
tr{
background: #e9e9e9;
}
body{
font-family: Helvetica;
}
i{
font-size: 8pt;
}
tr:nth-child(even) {
background: #e9e9e9;
}
</style>
<script type="text/javascript" src="jq/jquery-2.2.0.js"></script>
<script type="text/javascript" src="jqm/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header"><h1><center><b>WELCOME TO SORTINGSITE</b></center></h1></div>
<br />
<br />
<div data-role="content">
<form method="post" name="a1" action="index.php">
<div data-role="fieldcontain">
<div>
<label><b>Gelombang : </b></label>
<select name="listGel" >
<option value="">--Pilih--</option>
<?php
$listQuery = "select gelombang from tbl_identitas group by gelombang";
if ($gel = mysql_query($listQuery)) {
while ($row = mysql_fetch_object($gel)) {
echo "<option value='$row->gelombang'>$row->gelombang</option>";
}
}
?>
</select>
</div>
<br>
<div>
<label><b>Program Studi : </b></label>
<select name="listProd">
<option value="">--Pilih--</option>
<?php
$listQuery = "select prodi from tbl_identitas group by prodi";
if ($gel = mysql_query($listQuery)) {
while ($row = mysql_fetch_object($gel)) {
echo "<option value='$row->prodi'>$row->prodi</option>";
}
}
?>
</select></div>
<br>
<div>
<label><b>Status Ujian : </b></label>
<select name="listSUjian">
<option value="">--Pilih--</option>
<?php
$listQuery = "select ujian from tbl_identitas group by ujian";
if ($gel = mysql_query($listQuery)) {
while ($row = mysql_fetch_object($gel)) {
echo "<option value='$row->ujian'>$row->ujian</option>";
}
}
?>
</select></div>
<br>
<div data-role="button">
<input type="submit" name="a1" align="center" value="Search" />
</div>
</form>
<?php
if (isset($display_result)) {
?>
<br/><br/>
<h3 align="center" id="hasil">Entries Found: <?php echo $found_rows; ?></h3>
<table align="center" data-role="table" class="ui-responsive ui-shadow">
<!--<table align="center" cellpadding="2" cellspacing="0" border="1" >-->
<thead>
<tr>
<th align="center"><font color="black" size="2"><strong>GELOMBANG</strong></font>
</th>
<th align= "center" width="70"><font color="black" size="2"><strong>NAMA</strong></font>
</th>
<th align= "center" width="70"><font color="black" size="2"><strong>NAMA ORANG TUA PEREMPUAN</strong></font>
</th>
<th align= "center" width="70"><font color="black" size="2"><strong>NIK</strong></font>
</th>
<th align= "center" width="70"><font color="black" size="2"><strong>NO TELP</strong></font>
</th>
<th align= "center" width="70"><font color="black" size="2"><strong>EMAIL</strong></font>
</th>
<th align= "center" width="70"><font color="black" size="2"><strong>PRODI</strong></font>
</th>
<th align= "center" width="70"><font color="black" size="2"><strong>STATUS</strong></font>
</th>
<th align= "center" width="70"><font color="black" size="2"><strong>STATUS UJIAN</strong></font>
</th>
</tr>
</thead>
<?php
while ($rs = mysql_fetch_object($q)) {
?>
<tbody>
<tr>
<td><font color="black"><?php echo $rs->gelombang; ?></font>
</td>
<td align='center'><font color="black" ><?php echo $rs->nama; ?></font>
</td>
<td align='center'><font color="black" ><?php echo $rs->n_ibu; ?></font>
</td>
<td align='center'><font color="black"><?php echo $rs->nik; ?></font>
</td>
<td align='center'><font color="black"><?php echo $rs->no_telp; ?></font>
</td>
<td align='center'><font color="black"><?php echo $rs->email; ?></font>
</td>
<td align='center'><font color="black"><?php echo $rs->prodi; ?></font>
</td>
<td align='center'><font color="black"><?php echo $rs->status; ?></font>
</td>
<td align='center'><font color="black"><?php echo $rs->ujian; ?></font>
</td>
</tr>
</tbody>
<?php
}
?>
<?php
while ($r = mysql_fetch_object($q)) {
echo "<tr>
<td align='center'><font color='black' size='2'><b>$r->Nama</b></font>
</td>
</tr>";
}
?>
</table>
<?php
}
?>
</div>
</div>
<div data-role="footer">
<i><center>Copyright Zuliandri © 2016</center></i>
</div>
</body>
</html>
Dosen Pengampuh Matakuliah
Nama : M. Ropianto, M.Kom
NIDN : 1028067804
Status : Doesn Tetap YAPISTA/stt Ibnu Sina
Pengampu Matakuliah : Pemograman Mobile Lanjutan
Nama : M. Ropianto, M.Kom
NIDN : 1028067804
Status : Doesn Tetap YAPISTA/stt Ibnu Sina
Pengampu Matakuliah : Pemograman Mobile Lanjutan
