<?php
include "konek.php";
$judul=$_POST['judul'];
$cover=(rand()%99999);
$kategori=$_POST['kategori'];
$penerbit=$_POST['penerbit'];
$pengarang=$_POST['pengarang'];
$sinopsis=$_POST['sinopsis'];
$lokasi=$_POST['lokasi'];
$harga=$_POST['harga'];
$id=$_POST['id'];
mysql_query("update buku set judul='$judul',cover='$cover.jpg',kategori='$kategori',penerbit='$penerbit',pengarang='$pengarang',sinopsis='$sinopsis',lokasi='$lokasi',harga='$harga' where id='$id'");
$f=$_FILES['cover'];
$na=$f['name'];
if (!empty ($na)) {
mysql_query("update buku set cover='$cover.jpg' where id='$id'");
move_uploaded_file($_FILES['cover']['tmp_name'],"cover/$cover.jpg");
}
header("location:view.php");
?>
No comments:
Post a Comment