106 lines
3.2 KiB
PHP
106 lines
3.2 KiB
PHP
|
<!doctype html>
|
||
|
<?php
|
||
|
include 'query.php';
|
||
|
//$result = getmhs();
|
||
|
?>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<title>Document</title>
|
||
|
<link href="style.css" rel="stylesheet">
|
||
|
<link href="bootstrap.min.css" rel="stylesheet">
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="container" style="margin-top:50px;">
|
||
|
<div class="row">
|
||
|
<div class="navbar span11">
|
||
|
<div class="navbar-inner">
|
||
|
<form class="navbar-search pull-left" method="get" action="index.php">
|
||
|
<div class="input-append">
|
||
|
<input type="text" class="span2 search-query" name="search" placeholder="Search...">
|
||
|
</div>
|
||
|
</form>
|
||
|
<a href="form.php"><button class="btn btn-small btn-primary pull-right" style="margin-top:8px;">+ Tambah</button></a>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="row"><div class="span11">
|
||
|
<div class="tabel">
|
||
|
<table class="table table-striped table-bordered">
|
||
|
<thead>
|
||
|
<th style="width:100px">NIM</th>
|
||
|
<th style="width:100px">Nama</th>
|
||
|
<th style="width:200px">Alamat</th>
|
||
|
<th style="width:130px">Telp</th>
|
||
|
<th style="width:200px">Sekolah Asal</th>
|
||
|
<th style="width:50px">Action</th>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<?php
|
||
|
$BatasAwal = 5;
|
||
|
if (!empty($_GET['page'])) {
|
||
|
$page = $_GET['page'] - 1;
|
||
|
$MulaiAwal = $BatasAwal * $page;
|
||
|
} else if (!empty($_GET['page']) and $_GET['page'] == 1) {
|
||
|
$MulaiAwal = 0;
|
||
|
} else if (empty($_GET['page'])) {
|
||
|
$MulaiAwal = 0;
|
||
|
}
|
||
|
if ((isset($_GET['search'])) && (($_GET['search'])!='')){
|
||
|
$car = $_GET['search'];
|
||
|
$query = mysql_query("SELECT * FROM mahasiswa WHERE nama LIKE '%$car%' or nim LIKE '%$car%' LIMIT $MulaiAwal , $BatasAwal");
|
||
|
}
|
||
|
else{
|
||
|
$query = mysql_query("SELECT * FROM mahasiswa LIMIT $MulaiAwal , $BatasAwal");
|
||
|
}
|
||
|
while($data = mysql_fetch_array($query)) {
|
||
|
?>
|
||
|
<tr>
|
||
|
<td><?php echo $data['nim'] ?></td>
|
||
|
<td><?php echo $data['nama'] ?></td>
|
||
|
<td><?php echo $data['alamat'] ?></td>
|
||
|
<td><?php echo $data['telp'] ?></td>
|
||
|
<td><?php echo $data['asal'] ?></td>
|
||
|
<td>
|
||
|
<a href="<?php echo 'view.php?id='.$data['nim'] ?>"><i class="icon-eye-open"></i></a>
|
||
|
<a href="<?php echo 'form.php?id='.$data['nim'] ?>"><i class="icon-edit"></i></a>
|
||
|
<a href="<?php echo 'query.php?id='.$data['nim'].'&action=delete' ?>"><i class="icon-trash"></i></a>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<?php
|
||
|
}
|
||
|
?>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
</div></div>
|
||
|
<div class="paging span11" style="text-align:center;">
|
||
|
<?php
|
||
|
if ((isset($_GET['search'])) && (($_GET['search'])!='')){
|
||
|
$car = $_GET['search'];
|
||
|
$cekQuery = mysql_query("SELECT * FROM mahasiswa WHERE nama LIKE '%$car%' or nim LIKE '%$car%'");
|
||
|
}
|
||
|
else{
|
||
|
$cekQuery = mysql_query("SELECT * FROM mahasiswa");
|
||
|
}
|
||
|
$jumlahData = mysql_num_rows($cekQuery);
|
||
|
echo $jumlahData;
|
||
|
if ($jumlahData > $BatasAwal) {
|
||
|
echo '<div class="pagination" style="font-size:10pt;"><ul>';
|
||
|
$c = ceil($jumlahData / $BatasAwal);
|
||
|
for ($i = 1; $i <= $c; $i++) {
|
||
|
echo '<li ';
|
||
|
if ($_GET['page'] == $i) {
|
||
|
echo 'class="active"';
|
||
|
}
|
||
|
echo "><a href=?";
|
||
|
if(isset($_GET['search']))echo "search=".$_GET['search'];
|
||
|
echo "&page=".$i.">".$i."</a></li>";
|
||
|
}
|
||
|
echo '</ul></div>';
|
||
|
}
|
||
|
?>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|