<?php
include "../koneksi.php";

$jg=$_POST['ja'];
$isi=$_POST['isi'];
$foto=$_FILES['foto_a']['name'];
$id=$_POST['id'];

 if($jg=="")
{
	echo "<script>alert('Judul Artikel Harap Di ISI ');location.href='?page=input_artikel'</script>";
}
else if($isi=="")
{
	echo "<script>alert('Keterangan Harap Di ISI');location.href='?page=input_artikel'</script>";
}
else if($foto=="")
{
	$query=mysql_query("update artikel set judul_artikel='$jg',isi_artikel='$isi', tanggal_update_artikel=NOW(),penulis='$_POST[pen]' where id_artikel='$id'")or die(mysql_error());		
}

	else 
{
$query=mysql_query("update artikel set judul_artikel='$jg',isi_artikel='$isi',gambar_artikel='$foto',tanggal_update_artikel=NOW(),penulis='$_POST[pen]' where id_artikel='$id'")or die(mysql_error());	
copy($_FILES['foto_a']['tmp_name'],"fotoartikel/".$foto);
}	
	if ($query){
	
	echo "<script>alert('Berhasil Merubah Artikel'); location.href='?page=data_artikel'</script>";
	}
	else
	{
	echo"Proses Gagal";
	}
	
	
?>	
