<?php
ob_start();
session_start();
include("../../../config.php");
$dte=date('d/m/Y');
$dtdoc=date('Y-m-d');
$dteE=date('Y-m-d h:i:s');
$added_by=$_SESSION['user'];
$added_on=date('Y-m-d h:i:s');
$filephoto=$_FILES['pdf']['name'];
$uploadphoto=$_SERVER['DOCUMENT_ROOT'].$download_path;
$fileNamephoto=$filephoto;
$target_pathphoto = $uploadphoto . $fileNamephoto;
move_uploaded_file($_FILES['pdf']['tmp_name'], $target_pathphoto);
$sql=mysqli_query($conn,"select * from latest where id='".$_POST['idD']."'");
$rw=mysqli_fetch_array($sql);
$pdf=$rw['pdf'];
if($_FILES['pdf']['name']==''){
$pdff=$pdf;
}else{
$pdff=$fileNamephoto;
}
$sqlBl="UPDATE latest SET ";
$sqlBl=$sqlBl."title='".$_POST['title']."',";
$sqlBl=$sqlBl."link='".$_POST['link']."',";
$sqlBl=$sqlBl."pdf='".$pdff."',";
$sqlBl=$sqlBl."added_by='".$added_by."',";
$sqlBl=$sqlBl."added_on='".$added_on."'";
$sqlBl=$sqlBl." where id='".$_POST['idD']."'";
$UsQuery=mysqli_query($conn,$sqlBl);
if($UsQuery){
header('location:'.$home_path.'/pages/master/editlatest.php?msg=success&id='.$_POST['idD']);
}else{
header('location:'.$home_path.'/pages/master/editlatest.php?msg=error&id='.$_POST['idD']);
}
?>
|