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

51 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,'Side Effect','SAVE','save_side_effect_list.php');
$noOfRows=$_POST['count_items'];
error_log("rows: ".$noOfRows);
// $dis_agncy = $_POST['dis_agncy'];
//echo "hello".$noOfRows;
$id = $_POST['sideeffect_id'];
for($i=0;$i<$noOfRows;$i++){
$id_str="sideeffect_id".$i;
$id=$_REQUEST[$id_str];
// echo $id;
error_log("sideeffect_id".$id);
//echo $procurement_refno;
$query_initial="";
$endquery="";
begin();
if(!empty($id)){
$query_initial="update ";
$endquery=" where sideeffect_id = '".$id."' ";
}else{
$query_initial="insert into ";
}
$query=$query_initial." side_effects set sideeffect_name ='".${"sideeffect_name$i"}."',modified_by = '".$_SESSION['user_id']."' ".$endquery;
// echo $query;
error_log($query);
if (!$result = @mysqli_query($conn,$query)) {
rollback();
exit(error_log(mysqli_error($conn)));
}
}
commit();
?>