processbook.php 4.12 KB
Newer Older
1 2 3
<?php
	require_once("koneksi.php");
    include 'header.php';
4 5 6 7 8 9 10 11 12 13 14

    $per_hal		= 10;
	$jumlah_record	= mysqli_query($koneksi, "SELECT * FROM t_buku");
	$no 			= 1;
	$jum 			= mysqli_num_rows($jumlah_record);
	$halaman 		= ceil($jum / $per_hal);
	$page 			= (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
	$start 			= ($page - 1) * $per_hal;
	
    global $sql;
	$sql = mysqli_query($koneksi, "SELECT * FROM t_buku LIMIT $start, $per_hal");
15 16 17 18 19 20 21 22
?>

	<!-- breadcrumbs -->
		<div class="breadcrumbs">
			<div class="container">
				<ol class="breadcrumb breadcrumb1">
					<li><span><i class="fa fa-sign-in" aria-hidden="true"></i><a href="login.php"> Masuk</a></span></li>
					<li class="active">Kelola Data Buku</li>
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
					<?php 
						if(isset($_POST['cari'])){
							$cari 	= $_POST['search'];
							$sql 	= mysqli_query($koneksi, "SELECT * FROM t_buku WHERE judul LIKE '%$cari%' ORDER BY isbn");
						}
					?>
					<div class="w3l_search">
						<form action="" method="post">
							<input type="search" name="search" placeholder="Cari Judul Buku" required="">
							<button type="submit" class="btn btn-default search" aria-label="Left Align" name="cari">
								<i class="fa fa-search" aria-hidden="true"> </i>
							</button>
							<div class="clearfix"></div>
						</form>
					</div>
38 39 40 41 42
				</ol>
			</div>
		</div>
	<!-- //breadcrumbs -->
		<div class="col-md-12">
43
			<table class="col-md-3">
44
				<tr>
45
					<br>
46
					<td>Jumlah Data Buku</td>		
47
					<td>:<b> <?php echo $jum; ?></b></td>
48 49 50 51
				</tr>
			</table>
		</div>
	<!-- checkout -->
52 53
			<div class="container"><br><br><br>
				<h2>Detail Buku : </h2><br>
54
				<div class="checkout-right">
55
					<table class="timetable_sub table table-bordered table-hover">
56
						<thead>
57
							<tr>	
58 59 60 61 62 63
								<th>ISBN</th>
								<th>Judul</th>
								<th>Pengarang</th>
								<th>Tahun</th>		
								<th>Harga</th>
								<th>Jumlah</th>
64
								<th>Pengelola</th>
65 66 67
								<th>Opsi</th>
							</tr>
						</thead>
68 69
						<?php	 
							while($data = mysqli_fetch_array($sql)) {	
70 71 72 73 74 75 76 77
						?>
						<tr class="rem1">
							<td class="invert"><?php echo $data['isbn']; ?></td>
							<td class="invert"><?php echo $data['judul']; ?></td>
							<td class="invert"><?php echo $data['pengarang']; ?></td>
							<td class="invert"><?php echo $data['tahun']; ?></td>
							<td class="invert">Rp.<?php echo number_format($data['harga'],2,",",".");?></td>
							<td class="invert"><?php echo $data['jumlah']; ?></td>
78 79
							<td class="invert"><?php echo $data['username']; ?></td>
							<td class="col-md-2">
80 81
								<div class="rem">
									<div>
82 83 84 85
										<a href="singlebook.php?kd=<?php echo $data['isbn'];?>">
											<img src="images/search.png" />
										</a>
						                <a href="editbook.php?id=<?php echo $data['isbn']; ?>">
86 87
						                	<img src="images/edit.png" />
						                </a>
88
						                <a onclick="if(confirm('Apakah Anda yakin ingin menghapus data ini ?')){ location.href='deletebook_process.php?id=<?php echo $data['isbn']; ?>' }">
89 90 91 92 93 94 95 96 97 98 99 100
						                	<img src="images/close_1.png" />
						                </a>
									</div>
								</div>
							</td>
						</tr>
						<?php
							}
						?>
						<?php
							if(	isset($_SESSION['administrator'])){
								echo '
101
									<tr><td colspan="7" align="center" style="background-color:#ffffff"><b> Tambah Data Buku </b></td>
102
									<td><a href="addbook.php"><img src="images/tambah.png" /></td></tr></table>
103 104 105 106
								';
							}
							else {
								echo '
107
									<tr><td colspan="8" align="center" style="background-color:#ffffff"> Data buku kosong ! </td></tr></table>
108 109 110 111 112 113 114 115 116
								';
							}
						?>
					</table>
				</div>
			<nav class="numbering">
				<ul class="pagination paging">
					<li>
						<?php 
117
							for($page=1;$page<=$halaman;$page++){
118
								?>
119
								<li><a href="?page=<?php echo $page ?>"><?php echo $page ?></a></li>
120 121 122 123 124
								<?php
							}
						?>
					</li>
					<!--<li>
125
						<a href="?page=<?php echo $page++ ?>" aria-label="Next">
126 127 128 129 130 131 132 133 134 135 136 137
						<span aria-hidden="true">&raquo;</span>
						</a>
					</li>-->
					<br><br><br>
				</ul>
			</nav>		
		</div>
	<!-- //checkout -->

<?php
	include 'footer.php';
?>