<?php
include("../../db.php");
//header("Access-Control-Allow-Origin: * ");
header('Content-Type: application/json');

    $class = $_REQUEST['class'];
	$array = array();
	$status = 0;

    $subjectArray = array();

	$allSubject = $db->getRows("select * from subject_new where class='$class' and type='subject'  ");
    if(count($allSubject) > 0){
        $status = 1;

    	foreach($allSubject as $subject){
                array_push($subjectArray,["id"=>"$subject[id]","subject"=>"$subject[subject]", "image"=>"uploads/subjectimage/$subject[subject_image]" ]);
    	}

    }


    $array['status'] = $status;
    $array['data'] = $subjectArray;

    echo json_encode($array);

	?>