39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
include('includes/functions.php');
|
|
|
|
|
|
$flag = 0;
|
|
|
|
if (isset($_REQUEST['fromDate']) && isset($_REQUEST['toDate'])) {
|
|
$from_date = $_REQUEST['fromDate'];
|
|
$to_date = $_REQUEST['toDate'];
|
|
|
|
$from_year = date('Y', strtotime($from_date));
|
|
$to_year = date('Y', strtotime($to_date));
|
|
|
|
$ohc_type_id = $_REQUEST['ohc'];
|
|
|
|
if ($from_year === $to_year) {
|
|
$query = "SELECT form_data FROM bio_waste_form_doc WHERE for_year = ? AND ohc_type_id = ? ";
|
|
$stmt = mysqli_prepare($conn, $query);
|
|
|
|
if ($stmt) {
|
|
mysqli_stmt_bind_param($stmt, "ss", $from_year, $ohc_type_id);
|
|
mysqli_stmt_execute($stmt);
|
|
$result = mysqli_stmt_get_result($stmt);
|
|
if (mysqli_num_rows($result) > 0) {
|
|
error_log("flag is " . $flag);
|
|
$flag = 1;
|
|
}
|
|
} else {
|
|
error_log("failed in making stmt" . $conn->errno);
|
|
$flag = 0;
|
|
}
|
|
} else {
|
|
$flag = 0;
|
|
}
|
|
}
|
|
|
|
echo json_encode($flag);
|