45 lines
1.3 KiB
PHP
45 lines
1.3 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, 'abnormality master', 'SAVE', 'save_abnormality_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 abnormality_id = '" . $id . "' ";
|
|
} else {
|
|
$query_initial = "insert into ";
|
|
}
|
|
|
|
error_log('progarms'.addslashes(${"progarm_id$i"}));
|
|
$query = $query_initial . " abnormality set abnormality_name ='" . strtoupper(${"abnormality_name$i"}) . "',wellness_program ='" . addslashes(${"progarm_id$i"}) . "',modified_by = '" . $_SESSION['user_id'] . "' " . $endquery;
|
|
|
|
error_log($query);
|
|
if (!$result = @mysqli_query($conn, $query)) {
|
|
rollback();
|
|
exit(error_log(mysqli_error($conn)));
|
|
}
|
|
}
|
|
commit(); |