csrtechnew.ohctech.in/select_exam_schedule.php

38 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2025-04-14 13:28:09 +05:30
<?php
include('includes/config/config.php');
include('includes/functions.php');
$talukaId = $_REQUEST['id'];
// Use the correct variable for the query
$query = "SELECT * FROM exam_schedule WHERE id = '".$talukaId."'";
if (!$result = @mysqli_query($conn, $query)) {
exit(mysqli_error($conn));
}
$data = array();
if (mysqli_num_rows($result) > 0) {
$row = mysqli_fetch_assoc($result);
$data = $row; // Store the row data
// Get the training program ID based on the batch ID
$training_program_id = getFieldFromTable('training_program_id', 'training_batch_master', 'batch_id', $row['batch_id']);
// Get the course name based on the training program ID
$course_name = getFieldFromTable('name', 'courses', 'id', $training_program_id);
$data['course_name'] = $course_name;
// Set success status
$data['status'] = 200; // Indicate successful retrieval
} else {
$data['status'] = 404; // Use a more appropriate status code for not found
$data['message'] = "Data not found!";
}
// Return the response as JSON
header('Content-Type: application/json'); // Set content type for JSON response
echo json_encode($data);
?>