37 lines
824 B
PHP
37 lines
824 B
PHP
<?php
|
|
include ('includes/config/config.php');
|
|
include ('log_entry.php');
|
|
|
|
|
|
if ($conn->connect_error) {
|
|
die("Connection failed: " . $conn->connect_error);
|
|
}
|
|
$ohc_type_id = "ohc_type_id = ".$_SESSION['current_ohcttype'];
|
|
$userid=$_SESSION['user_id'];
|
|
error_log("Check_user_id : ".$userid);
|
|
|
|
|
|
$query = "SELECT * from user_preference WHERE status = 'Active' AND $ohc_type_id AND user_id = $userid";
|
|
|
|
error_log("Check_beneficiary".$query);
|
|
$result = mysqli_query($conn, $query);
|
|
|
|
|
|
$data = "";
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$data = $row;
|
|
error_log("check_data".$data['village']);
|
|
|
|
}else {
|
|
// If no data is found, set status and message
|
|
$data['status'] = 200;
|
|
$data['message'] = "Data not found!";
|
|
}
|
|
|
|
// Output the data as JSON
|
|
echo json_encode($data);
|
|
mysqli_close($conn);
|
|
|
|
?>
|