File "read_single.php"
Full path: /home2/santhos2/public_html/bharath-coe.firstmatrix.in.net/api/seed/read_single.php
File size: 0.98 KiB (1007 bytes)
MIME-type: text/x-php
Charset: utf-8
<?php
require_once '../../config/config.php';
header('Content-Type: application/json');
try {
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
if ($id <= 0) { echo json_encode(['status'=>'error','message'=>'id required']); exit; }
$stmt = $pdo->prepare('SELECT hall_setting_id, hall_id, rows_count, columns_count, seating_method, bench_capacity, max_students, row_labeling, internal_invigilators_required, external_invigilators_required,
COALESCE(aisle_every_n_cols, 0) AS aisle_every_n_cols, COALESCE(aisle_every_n_rows, 0) AS aisle_every_n_rows
FROM hall_settings WHERE hall_setting_id = ?');
$stmt->execute([$id]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$row) { echo json_encode(['status'=>'error','message'=>'Not found']); exit; }
echo json_encode($row);
} catch (Throwable $e) {
http_response_code(500);
echo json_encode(['status'=>'error','message'=>$e->getMessage()]);
}
?>