65 lines
1.9 KiB
PHP
65 lines
1.9 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
include ('includes/functions.php');
|
|
include ('log_entry.php');
|
|
error_log ( "Start Printing Request Attributes" );
|
|
$requestStr="";
|
|
foreach ( $_REQUEST as $key => $value ) {
|
|
$requestStr.=$key . " : " . $value . "\n";
|
|
error_log ( $key . " : " . $value . "<br />\r\n" );
|
|
}
|
|
error_log ( "End Printing Request Attributes" );
|
|
save_log($requestStr,'Ailment System','SAVE','save_ailment_system.php');
|
|
$ailment_id = $_POST['ailment_system_id'];
|
|
$ailment_name =$_POST['ailment_system_name'];
|
|
$ailment_desc = $_POST['ailment_system_description'];
|
|
$ailment_code= $_POST['ailment_system_code'];
|
|
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
|
|
if(!empty($ailment_id)){
|
|
$query = "update ailment_system set ailment_sys_name = '$ailment_name', ailment_sys_desc = '$ailment_desc', ailment_sys_code = '$ailment_code',modified_by = '".$_SESSION['user_id']."' where ailment_sys_id =
|
|
'".$ailment_id."' ";
|
|
}
|
|
else {
|
|
$query = "insert into ailment_system(ailment_sys_name,ailment_sys_desc,ailment_sys_code,modified_by)
|
|
values ('$ailment_name','$ailment_desc','$ailment_code','".$_SESSION['user_id']."' ); ";
|
|
}
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}else{
|
|
|
|
|
|
$query = "select max(ailment_sys_id) ailment_sys_id from ailment_system ";
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
if(mysqli_num_rows($result) > 0) {
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$ailment_sys_id_max = $row['ailment_sys_id'];
|
|
}
|
|
}
|
|
|
|
|
|
$query = "select * from ailment_system where ailment_sys_id='".$ailment_sys_id_max."'";
|
|
//echo $query;
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
if(mysqli_num_rows($result) > 0) {
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$data=$row;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
if($data==null)
|
|
{
|
|
$data['status'] = 200;
|
|
$data['message'] = "Data not found!";
|
|
}
|
|
echo json_encode($data);
|
|
?>
|