} } else { if (file_exists("asset/img/upload/" . $foto)) { $sql = "UPDATE `barang` SET `nama_barang`='{$nama}',`id_kategori`='{$kategori}',`harga`='{$harga}',`detail`='{$detail}' WHERE `id_barang`='{$id}'"; Barang::updateBarang($sql); } else { $sql = "UPDATE `barang` SET `nama_barang`='{$nama}',`id_kategori`='{$kategori}',`harga`='{$harga}',`foto`='{$foto}',`detail`='{$detail}' WHERE `id_barang`='{$id}'"; Barang::updateBarang($sql); move_uploaded_file($_FILES["foto"]["tmp_name"], "../images/" . $foto); } } } } else { if ($proses == "delete") { $sql = "DELETE FROM `barang` WHERE `id_barang`='{$id}'"; Barang::deleteBarang($sql); } else { ?> <div class="row"> <!-- page header --> <div class="col-lg-12"> <h1 class="page-header">Data Barang</h1> </div> <!-- end page header --> </div> <div class="row"> <div class="col-lg-12"> <!-- Advanced Tables --> <div class="panel panel-default"> <div class="panel-heading"> Advanced Tables