csrtechnew.ohctech.in/fetch_schedule_info.php
2025-04-14 13:28:09 +05:30

38 lines
1.2 KiB
PHP

<?php
include('includes/config/config.php');
include('includes/functions.php');
$id = $_REQUEST['id'];
// Use the correct variable for the query
$query = "SELECT * FROM exam_schedule WHERE id = '".$id."'";
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
$subject_name = getFieldFromTable('subject_name', 'subjects', 'subject_id', $row['subject_id']);
$data['subject_name'] = $subject_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);
?>