ohctech_p8/save_bio_medical_waste_mines.php
Dushant Mali 899fb3e65a Upgrade 7 to 8
Upgrade 7 to 8
2024-11-02 18:03:13 +05:30

54 lines
1.5 KiB
PHP

<?php
include('includes/config/config.php');
include('includes/functions.php');
$noOfRows=$_POST['count_items'];
$forward_status = $_POST['forward_status'];
$waste_gen_date = $_POST['waste_gen_date'];
//echo $procurement_refno;
for($i=0;$i<$noOfRows;$i++){
$waste_id_str="waste_id".$i;
$waste_id =$_REQUEST[$waste_id_str];
//echo "wastevalue".$waste_id;
$query_initial="";
$endquery="";
begin();
$sql="SELECT * FROM `bio_medical_waste_new` WHERE waste_gen_date=STR_TO_DATE('".${"waste_gen_date$i"}."','%d/%m/%Y')";
$resultl = mysqli_query($conn,$sql);
$rowl=mysqli_fetch_array($resultl);
if(!empty($waste_id)){
$query_initial="update ";
$endquery=" where waste_id = '".$waste_id."' ";
}else{
$query_initial="insert into ";
}
$query=" bio_medical_waste_new set waste_gen_date=STR_TO_DATE('".${"waste_gen_date$i"}."','%d/%m/%Y'),mines_yellow_qty = '".${"mines_yellow_qty$i"}."',yellow_qty_total ='".${"mines_yellow_qty$i"}."'+plant_yellow_qty,mines_white_qty='".${"mines_white_qty$i"}."',white_qty_total='".${"mines_white_qty$i"}."'+ plant_white_qty,mines_blue_qty='".${"mines_blue_qty$i"}."',blue_qty_total='".${"mines_blue_qty$i"}."'+plant_blue_qty, mines_red_qty='".${"mines_red_qty$i"}."',red_qty_total='".${"mines_red_qty$i"}."'+ plant_red_qty,modified_by = '".$_SESSION['user_id']."' ";
$query=$query_initial.$query.$endquery;
error_log($query);
if (!$result = mysqli_query($conn,$query)) {
rollback();
die(mysqli_error($conn));
}
}
commit();
?>