53 lines
1.7 KiB
PHP
53 lines
1.7 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
include('includes/functions.php');
|
|
include('log_entry.php');
|
|
|
|
// error_log($_POST['id']);
|
|
|
|
$initial_query = "";
|
|
$end_query = "";
|
|
|
|
$id = $_POST['id'];
|
|
$client_name = $_POST['client_name'];
|
|
$client_contact = $_POST['client_contact'];
|
|
$client_email = $_POST['client_email'];
|
|
$remarks = $_POST['remarks'];
|
|
$modified_by = $_SESSION['user_id'];
|
|
$ohc_type=$_SESSION['current_ohcttype'];
|
|
|
|
$locations = $_REQUEST['client_location'];
|
|
$location = implode(',', $locations);
|
|
// if(!empty($_POST['id'])){
|
|
|
|
|
|
// $initial_query=" UPDATE client_master ";
|
|
// $end_query="where id='".$_POST['id']."' ";
|
|
// }else{
|
|
|
|
// $initial_query="INSERT INTO client_master ";
|
|
// $end_query="";
|
|
// }else{
|
|
|
|
if (empty($id)) {
|
|
$final_query = "INSERT INTO `client_master` (`client_name`, `client_email`, `client_contact`, `remarks`, `modified_by`,`ohc_type`) VALUES ('$client_name','$client_email','$client_contact','$remarks','$modified_by','$ohc_type')";
|
|
} else {
|
|
$final_query = "UPDATE `client_master` SET `client_name`='$client_name' , `client_email`='$client_email' ,`client_contact`='$client_contact',`remarks`='$remarks',`modified_by`='$modified_by',`ohc_type`='$ohc_type' WHERE `id`='$id' ";
|
|
}
|
|
|
|
error_log("update client " . $final_query);
|
|
|
|
// $final_query=$initial_query."set client_name='".$_POST['client_name']."',client_email=LOWER('".$_POST['client_email']."',client_contact='".$_POST['client_contact']."',remarks='".$_POST['remarks']."',modified_by='".$_SESSION['user_id']."' ".$end_query;
|
|
// echo $final_query;
|
|
|
|
|
|
if (!$result = @mysqli_query($conn, $final_query)) {
|
|
exit(mysqli_error($conn));
|
|
$data = "error";
|
|
} else {
|
|
|
|
$data = "success";
|
|
}
|
|
|
|
echo json_encode($data);
|