ESH/save_chart_type.php
2024-10-23 18:28:06 +05:30

41 lines
1.4 KiB
PHP

<?php
include('includes/config/config.php');
include('includes/functions.php');
include('constants.php');
include('log_entry.php');
include('log_entry.php');
$initial_query="";
$end_query="";
foreach ($_REQUEST as $key => $value) {
error_log($key . " : " . $value . "\n");
}
$rule_equation_ids = implode(',', $_POST['rule_equation_ids']);
error_log("rule_equation_ids ".$rule_equation_ids);
error_log("check ".$_POST['flex_chart_id']);
if(!empty($_POST['flex_chart_id'])){
$initial_query=" update rule_chart ";
$end_query=" where chart_id='".$_POST['flex_chart_id']."' ";
}else{
$initial_query="insert into rule_chart ";
$end_query="";
}
$checkup_parameter_name = getTableFieldValue('checkup_parameter', 'parameter_name', 'checkup_parameter_id', $_POST['chart_name']);
error_log("check2 ".$_POST['chart_name']);
$roleId_tobeassigned = getFieldFromTable("checkup_parameter_id", "checkup_parameter", "parameter_name", $checkup_parameter_name);
$final_query=$initial_query." set chart_name='".$checkup_parameter_name."',rule_equation_ids='".$rule_equation_ids."',parameter_id='".$roleId_tobeassigned."',checkup_section='".$_POST['checkup_section']."',age_batch_id='".$_POST['age_batch_id']."'".$end_query;
// echo $_POST['primary_email'];
error_log($final_query);
if (!$result = @mysqli_query($conn,$final_query)) {
exit(mysqli_error($conn));
}else{
$data="success";
}
echo json_encode($data);