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

39 lines
2.2 KiB
PHP

<?php
include('includes/config/config.php');
include('includes/functions.php');
include('log_entry.php');
error_log('$SELECT REQ'.print_r($_REQUEST,true));
if (isset($_POST['rule_eq_id'])) {
error_log("got_id :" .$_POST['rule_eq_id']);
// select checkup_parameter, condition_id, joiner_id, cl_br, op_br, rule_s_val from rule_save where rule_s_id IN (select rule_s_id from rule_save where equation_rule_id ='5')
// originally used below one
// $query = "select checkup_parameter, condition_id, joiner_id, cl_br, op_br, rule_s_val from rule_save where rule_s_id IN (select rule_s_id from rule_save where equation_rule_id ='". $_POST['rule_eq_id']."' )";
$query = "select a.*, b.* FROM (select * from rule_save where rule_s_id IN (select rule_s_id from rule_save where equation_rule_id ='". $_POST['rule_eq_id']."' )) a left join rule_equation b on a.equation_rule_id=b.rule_eq_id ";
// $query="SELECT a.*, b.checkup_form_section_id, b.cout FROM rule_save a left join rule_equation b on a.equation_rule_id=b.rule_eq_id where a.equation_rule_id = '". $_POST['rule_eq_id']."' ";
// below check
// select a.*, b.result FROM (select * from rule_save where rule_s_id IN (select rule_s_id from rule_save where equation_rule_id ='26' )) a left join rule_equation b on a.equation_rule_id=b.rule_eq_id
// $query="SELECT a.user_name,a.status, a.email, a.user_id,a.user_password, a.role_id, b.role_name, a.patient_id,c.client_name, e.patient_name, a.remarks,a.ohc_type FROM tbl_users a left join role_master b on a.role_id=b.role_id left join patient_master e on a.patient_id=e.id left join client_master c on e.client_id = c.client_id where a.user_id = '".$userId."' ";
error_log("SELECT Rule:" . $query);
if (!$result = @mysqli_query($conn,$query)) {
exit(mysqli_error($conn));
}
$data = array();
$i=0;
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$data[$i] = $row;
$i++;
}
} else {
$data['status'] = '200';
$data['message'] = "Data not found!";
}
error_log("SELECT staff" . print_r($data, true));
echo json_encode($data);
}
?>