68 lines
1.7 KiB
PHP
68 lines
1.7 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,'Vaccine Master','SAVE','save_vaccine.php');
|
|
$id = $_POST['id'];
|
|
$name =$_POST['vaccine_name'];
|
|
$comp = $_POST['vaccine_company'];
|
|
$desc = $_POST['vaccine_desc'];
|
|
|
|
|
|
error_log("id: ".$id."name: ".$name."comp: ".$comp."desc: ".$desc);
|
|
|
|
if(!empty($id)){
|
|
$query = "update vaccine_master set vaccine_name = '$name', vaccine_company = '$comp', vaccine_desc = '$desc', modified_by = '".$_SESSION['user_id']."' where id = '".$id."'";
|
|
}
|
|
else {
|
|
$query = "insert into vaccine_master(vaccine_name, vaccine_company, vaccine_desc, modified_by)
|
|
values ('$name', '$comp', '$desc','".$_SESSION['user_id']."' ); ";
|
|
}
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
else{
|
|
|
|
|
|
$query = "select max(id) id from vaccine_master ";
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
if(mysqli_num_rows($result) > 0) {
|
|
while ($row = @mysqli_fetch_assoc($result)) {
|
|
|
|
$id_max = $row['id'];
|
|
}
|
|
}
|
|
|
|
|
|
$query = "select * from vaccine_master where id='".$id_max."'";
|
|
//echo $query;
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
if(mysqli_num_rows($result) > 0) {
|
|
while ($row = @mysqli_fetch_assoc($result)) {
|
|
|
|
$data=$row;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
if($data==null)
|
|
{
|
|
$data['status'] = 200;
|
|
$data['message'] = "Data not found!";
|
|
}
|
|
echo json_encode($data);
|
|
?>
|