<?php
include("../../db.php");
header('Content-Type: application/json');

$status = 0;
$msg = "Unable to fetch data..! Please retry later";
$data = array();

if (isset($_GET['teacher_id']) && isset($_GET['session'])){

    $teacher_id = $_GET['teacher_id'];
    $session    = $_GET['session'];

    $result = $db->getRows("SELECT * FROM exam_question WHERE teacher_id = '$teacher_id' AND session = '$session' ORDER BY id DESC");

    if ($result){
        $status = 1;
        $data = $result;
        $msg = "Record found";
    }else{
        $msg = "Record not found";
    }

}

echo json_encode(array("status" => $status, "data" => $data, "msg" => $msg));