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

45 lines
1.2 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, 'Parameter value master', 'SAVE', 'save_parameter_value_master.php');
$noOfRows = $_POST['count_items'];
error_log("rows: " . $noOfRows);
$id = $_POST['id'];
for ($i = 0; $i < $noOfRows; $i++) {
$id_str = "id" . $i;
$id = $_REQUEST[$id_str];
error_log("id" . $id);
$query_initial = "";
$endquery = "";
begin();
if (!empty($id)) {
$query_initial = "update ";
$endquery = " where parameter_value_id = '" . $id . "' ";
} else {
$query_initial = "insert into ";
}
$query = $query_initial . " checkup_parameter_value set parameter_value_name ='" . ${"parameter_value_name$i"} . "',modified_by = '" . $_SESSION['user_id'] . "' " . $endquery;
error_log($query);
if (!$result = @mysqli_query($conn, $query)) {
rollback();
exit(error_log(mysqli_error($conn)));
}
}
commit();