2024-10-16 19:18:52 +05:30
< ? 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 , 'Unit Master' , 'SAVE' , 'save_unit_list.php' );
$initial_query = " " ;
$end_query = " " ;
if ( ! empty ( $_POST [ 'unit_id' ])){
$initial_query = " update unit_master " ;
$end_query = " where unit_id=' " . $_POST [ 'unit_id' ] . " ' " ;
} else {
$initial_query = " insert into unit_master " ;
$end_query = " " ;
}
$final_query = $initial_query . " set unit_name=' " . $_POST [ 'unit_name' ] . " ',unit_remarks=' " . $_POST [ 'remarks' ] . " ',modified_by=' " . $_SESSION [ 'user_id' ] . " ' " . $end_query ;
error_log ( $final_query );
if ( ! $result = @ mysqli_query ( $conn , $final_query )) {
2024-11-02 18:03:13 +05:30
die ( mysqli_error ( $conn ));
2024-10-16 19:18:52 +05:30
$data = " error " ;
} else {
$data = " success " ;
}
echo json_encode ( $data );
?>