Advertisement
GWibisono

input ke database

Oct 29th, 2013
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. <?php
  2. include ('../koneksi.php');
  3. print_r($_POST);
  4.     $perintah "INSERT INTO buku (isbn, id_kategori, pengarang, judul_buku, penerbit, tahun_terbit, harga, jumlah, gambar) VALUES ('$_POST[isbn]','$_POST[id_kategori]','$_POST[pengarang]','$_POST[judul_buku]','$_POST[penerbit]','$_POST[tahun_terbit]','$_POST[harga]','$_POST[jumlah]','$_POST[gambar]')");
  5.  
  6. die($perintah); // hapus kl udah ok
  7.     $hasil = mysql_query($perintah) or die(mysql_error());
  8.     if($hasil){
  9.         echo "<script>alert('Berhasil'); history.go(-1)</script>";
  10.     } else {
  11.         echo "<script>alert('Gagal'); history.go(-1)</script>";
  12.     }
  13. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement