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

$session = $_GET['session'];

$class_array   = $db->getRows("select class from class");
$section_array = $db->getRows("select name from section");

$classJSON = array();
foreach ($class_array as $item) {
    $classJSON[] = $item['class'];
}

$sectionJSON = array();
foreach ($section_array as $item) {
    $sectionJSON[] = $item['name'];
}

$omrExam = $db->getRows("SELECT id,class,section,subject,sub_omr FROM subject WHERE session = '$session' ");

$examTerm = $db->getRows("select id,name from examname");

echo json_encode(array("status" => 1, "data" => array("class" => $classJSON, "section" => $sectionJSON, "exams" => $examTerm, "subject" => $omrExam)));