<?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');
$sqll1="insert into lastupdated(pagename,dtype,date,sts)";
$sqll1.=" values(";
$sqll1.="'Contact',";
$sqll1.="'add',";
$sqll1.="'".$dte."',";
$sqll1.="'1')";
/* echo $sqll1; */
$UsQueryy1 =mysqli_query($conn,$sqll1);
$sql=mysqli_query($conn,"select * from contact where id='1'");
if(mysqli_num_rows($sql)==0)
{
$sql="insert into contact(namea,mail,phno,map,details,added_by,added_on)";
$sql.=" values(";
$sql.="'".$_POST['namea']."',";
$sql.="'".$_POST['mail']."',";
$sql.="'".$_POST['map']."',";
$sql.="'".$_POST['phno']."',";
$sql.="'".$_POST['details']."',";
$sql.="'".$added_by."',";
$sql.="'".$added_on."')";
//echo $sql;
//die();
$UsQuery =mysqli_query($conn,$sql);
}else{
$sqlBl="UPDATE contact SET ";
$sqlBl=$sqlBl."namea='".$_POST['namea']."',";
$sqlBl=$sqlBl."mail='".$_POST['mail']."',";
$sqlBl=$sqlBl."map='".$_POST['map']."',";
$sqlBl=$sqlBl."phno='".$_POST['phno']."',";
$sqlBl=$sqlBl."details='".$_POST['details']."',";
$sqlBl=$sqlBl."added_by='".$added_by."',";
$sqlBl=$sqlBl."added_on='".$added_on."'";
$sqlBl=$sqlBl." where id='1'";
$UsQuery=mysqli_query($conn,$sqlBl);
}
if($UsQuery){
header('location:'.$home_path.'/pages/master/addcontact.php?msg=success&rcpt=');
}else{
header('location:'.$home_path.'/pages/master/addcontact.php?msg=error');
}
?>
|