File "read.php"

Full path: /home2/santhos2/public_html/bharath-coe.firstmatrix.in.net/api/question_paper_orders/read.php
File size: 0.98 KiB (1008 bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Back

<?php
require_once '../../config/config.php';
header('Content-Type: application/json');

try {
    $sql = "SELECT qpo.order_id, qpo.exam_subject_id, qpo.setter_id, qpo.status, qpo.time_duration,
                   qpo.approver_id, qpo.approved_at, qpo.final_pattern_id,
                   e.exam_name, sub.subject_name, sub.subject_code, sft.first_name AS setter_first, sft.last_name AS setter_last
            FROM question_paper_orders qpo
            JOIN exam_subjects es ON qpo.exam_subject_id = es.exam_subject_id
            JOIN exams e ON es.exam_id = e.exam_id
            JOIN subjects sub ON es.subject_id = sub.subject_id
            JOIN staff sft ON qpo.setter_id = sft.staff_id
            ORDER BY qpo.order_id DESC";
    $stmt = $pdo->query($sql);
    echo json_encode(['status'=>'success','data'=>$stmt->fetchAll(PDO::FETCH_ASSOC)]);
} catch (Throwable $e) {
    http_response_code(500);
    echo json_encode(['status'=>'error','message'=>$e->getMessage()]);
}
?>


PHP File Manager