$id= $_GET['id']; //get today's date $pecah = explode("-",$tgl_pinjam); $next_7_hari = mktime(0,0,0,$pecah[1],$pecah[0]+7,$pecah[2]); $hari_next = date("Y-m-d", $next_7_hari); //write a query to update that the book is returned $sql = "UPDATE peminjaman SET tgl_kembali='$hari_next' WHERE id_peminjaman='$id'"; $result = mysqli_query($connection, $sql); if($result){ echo"<script type='text/javascript'> onload =function(){ alert('Data berhasil diperpanjang!'); document.location='daftar-peminjaman.php'; } </script>"; }else{ echo "<script>alert('Data gagal diperpanjang. Silahkan cek kembali.');</script>"; }
<form role="form" method="GET"> <select name="category"> <option value="judul">Judul buku</option> <option value="pengarang">Pengarang</option> <option value="penerbit">Penerbit</option> <option value="subyek">Kategori</option> <option value="thn_terbit">Tahun terbit</option> <option value="no_rak">No Rak</option> <option value="isbn">ISBN</option> </select> <input type="text" placeholder="Masukkan kata kunci" name="keyword"> <input type="submit" name="search" value="cari" class="btn btn-info"> </form>
<div class="well well-lg" id="searchBox"> <h2 class="text-center">Pencarian Buku</h2> <div class="text-center"> <form role="form" method="GET"> <select name="category"> <option value="judul">Judul buku</option> <option value="pengarang">Pengarang</option> <option value="penerbit">Penerbit</option> <option value="subyek">Kategori</option> <option value="thn_terbit">Tahun terbit</option> <option value="isbn">ISBN</option> </select> <input type="text" placeholder="Masukkan kata kunci" name="keyword"> <input type="submit" name="search" value="cari" class="btn btn-info"> </form> </div> </div> <table class="table table-hover table-bordered"> <tr> <th>No.</th> <th>Judul</th> <th>Pengarang</th> <th>Penerbit</th> <th>Kategori</th> <th>Tahun terbit</th> <th>No Rak</th> <th>ISBN</th> <th>Action</th> </tr> <?php $sql="select * from buku,kategori where buku.id_kategori=kategori.id_kategori order by id_buku DESC"; $query=mysql_query($sql); $no=1; while($row=mysql_fetch_array($query)){ ?> <?php if(isset($_GET['category'])&&isset($_GET['keyword'])){ $category = $_GET['category']; $keyword = $_GET['keyword']; //search for data in table buku where category contains keyword $sql = "SELECT * FROM buku WHERE $category LIKE '%$keyword%'"; $result = mysqli_query($connection, $sql); $count=mysqli_num_rows($result); }else{ $sql = "SELECT * FROM buku;"; $result = mysqli_query($connection, $sql); $count=mysqli_num_rows($result); } if($count>0){ $number = 1; echo "<p>$count data ditampilkan.<p>"; while($row = mysqli_fetch_assoc($result)) { $id = $row["id_buku"]; echo "<tr> <td>" . $number. "</td><td> " . $row["judul"]. "</td><td> " . $row["pengarang"]."</td><td>". $row["penerbit"]."</td><td>". $row["nama_kategori"]."</td><td>". $row["thn_terbit"]."</td><td>". $row["deskripsi_fisik"]."</td><td>". $row["isbn"]."</td><td>".
<?php session_start(); require_once("connection.php"); $email = $_POST['email']; $password = $_POST['password']; $cekuser = mysql_query("SELECT * FROM user WHERE email = '$email'"); $jumlah = mysql_num_rows($cekuser); $hasil = mysql_fetch_array($cekuser); if($jumlah == 0) { echo "<script>alert('Email belum terdaftar!'); window.location = 'index.php'</script>"; } else { if($password > $hasil['password']) { echo "<script>alert('Password Salah!'); window.location = 'index.php'</script>"; } else { session_start(); $_SESSION['email'] = $_POST['email']; $_SESSION['password'] = $_POST['password']; header('location:index.php'); } } ?>
<?php if (session_status() == PHP_SESSION_NONE || session_id() == '') { session_start(); } require_once("connection.php"); include("lib_function.php"); ?> <--header--> $email = $_SESSION['email']; include "connection.php"; $sql = "select * from user where email='".$email."'"; $query = mysql_query($sql); while($data = mysql_fetch_array($query)){ echo "Hello, " . $data['nama'] . " <br> " . $data['nname'] . " <br> " . $data['bln'] . " <br> " . $data['gender'] . " (" . $data['email'] . ")."; }