Advertisement
gamamuhammad

act_kembali.php

Jan 17th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1. <?php
  2. include "../include/koneksi_db.php"; //memanggil file koneksi_db.php
  3. include "../include/config.php"; //memanggil file fungsi.php
  4. $id_trans   = isset($_GET['id_trans']) ? $_GET['id_trans'] : "";
  5. $judul      = isset($_GET['judul']) ? $_GET['judul'] : "";
  6. if ($id_trans==""||$judul=="") {
  7.     echo "<script>alert('Pilih dulu buku yang akan dikembalikan');</script>";
  8.     echo "<meta http-equiv='refresh' content='0; url=?page=transaksi'>";
  9. } else {
  10.     $us=mysql_query("UPDATE trans_pinjam SET status='kembali' WHERE id='$id_trans'")or die ("Gagal update".mysql_error());
  11.     $uj=mysql_query("UPDATE data_buku SET jum_temp=(jum_temp+1) WHERE judul='$judul'")or die ("Gagal update".mysql_error());
  12.     if ($us || $uj) {
  13.         echo "<script>alert('Berhasil Dikembalikan')</script>";
  14.         echo "<meta http-equiv='refresh' content='0; url=?page=transaksi'>";
  15.     } else {
  16.         echo "<script>alert('Gagal Dikembalikan')</script>";
  17.         echo "<meta http-equiv='refresh' content='0; url=?page=transaksi'>";
  18.     }
  19. }
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement