45 lines
1.5 KiB
PHP
45 lines
1.5 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, 'Ambulance Master', 'SAVE', 'save_ambulance_list.php');
|
|
$noOfRows = $_REQUEST['count_items'];
|
|
error_log("rows: " . $noOfRows);
|
|
// $dis_agncy = $_POST['dis_agncy'];
|
|
|
|
//echo "hello".$noOfRows;
|
|
$id = $_REQUEST['client_id'];
|
|
|
|
$query_initial = "";
|
|
$endquery = "";
|
|
begin();
|
|
$client_location_id = $_REQUEST['client_location_id'];
|
|
if (!empty($id)) {
|
|
$query_initial = "update ";
|
|
$endquery = " where client_location_id = '" . $client_location_id . "' ";
|
|
} else {
|
|
$query_initial = "insert into ";
|
|
;
|
|
}
|
|
$client_n = $_REQUEST['client_name'];
|
|
$ohc_type=$_SESSION['current_ohcttype'];
|
|
for ($i = 0; $i < $noOfRows; $i++) {
|
|
|
|
$query = $query_initial . " client_location set ohc_type ='$ohc_type', client_id = '$client_n', client_location = '" . ${"client_location$i"} . "', client_email = '" . ${"client_email$i"} . "',modified_by = '" . $_SESSION['user_id'] . "' , client_contact = '" . ${"client_contact$i"} . "' , client_city = '" . ${"client_city$i"} . "' , client_state = '" . ${"client_state$i"} . "' " . $endquery;
|
|
|
|
// echo $query;
|
|
error_log($query . "save query");
|
|
if (!$result = @mysqli_query($conn, $query)) {
|
|
rollback();
|
|
exit(error_log(mysqli_error($conn)));
|
|
}
|
|
}
|
|
commit();
|