我需要你的帮助。我的代码仅更新第一张图片。当我尝试更新另外两张图片时,我的代码无法正常工作。
这是我的代码
<?php
include ("config.php");
$id= $_POST['id'];
$judul = $_POST['judul'];
$tanggal = $_POST['tanggal'];
$konten1 = $_POST['konten1'];
$konten2 = $_POST['konten2'];
$konten3 = $_POST['konten3'];
$posisi=$_POST['posisi'];
$posisi2=$_POST['posisi2'];
$tema=$_POST['tema'];
$footer=$_POST['footer'];
$lokasi_file = $_FILES['banner']['tmp_name'];
$nama_file = $_FILES['banner']['name'];
$lokasi_foto1 = $_FILES['foto1']['tmp_name'];
$nama_foto1 = $_FILES['foto1']['name'];
$lokasi_foto2 = $_FILES['foto2']['tmp_name'];
$nama_foto2 = $_FILES['foto2']['name'];
$lokasi_logo = $_FILES['logo']['tmp_name'];
$nama_logo = $_FILES['logo']['name'];
if(isset($_FILES['logo'] ) && ($_FILES['banner']) && $_FILES['banner']['name'] !="" && $_FILES['logo']['name'] !="") {
$hapus = mysql_query("SELECT * FROM newsletter WHERE id='$id'");
$r=mysql_fetch_array($hapus);
$d = 'upload/'.$r['logo'];
$e = 'upload/'.$r['banner'];
unlink ($d);
unlink ($e);
move_uploaded_file($lokasi_logo,"upload/".$nama_logo);
move_uploaded_file($lokasi_file,"upload/".$nama_file);
if ($edit = mysql_query("UPDATE newsletter SET banner='$nama_file' , judul='$judul', tanggal='$tanggal', posisi='$posisi',konten1='$konten1', konten2='$konten2', konten3='$konten3', tema='$tema' ,posisi2 = '$posisi2', footer='$footer' , logo='$nama_logo' WHERE id='$id'")){
header("Location: newsletter.php");
exit();
}
die ("Terdapat kesalahan : ". mysql_error($konek));
}
if ($edit = mysql_query("UPDATE newsletter SET judul='$judul', tanggal='$tanggal', posisi='$posisi',konten1='$konten1', konten2='$konten2', konten3='$konten3' , tema='$tema' ,posisi2 = '$posisi2', footer='$footer' WHERE id='$id'")){
header("Location: newsletter.php");
exit();
}
die ("Terdapat kesalahan : ". mysql_error($konek));
?>
因此,如果我尝试更新横幅和徽标,我的代码只会更新横幅。徽标未更新。如果有人可以提供帮助,我会很高兴:)
编辑:
我的代码问题出现在if (isset)
之后我很困惑如何使用多个isset并使用