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

	$array = array();
	$status=0;
	
    $classArray = array();
	
	$allclasses = $db->getRows("select * from class where school_id=1  ");
    if(count($allclasses) > 1){
        $status = 1;
        
    	foreach($allclasses as $class){
                array_push($classArray,["id"=>"$class[id]","class"=>"$class[class]"]);
    	}
        
    }


    $arr_sec=$db->getRows("select name from section");
    $sec_arr = array();
    foreach ($arr_sec as $rows){
        $sec_arr[] = $rows['name'];
    }

	
    $array['status'] = $status;
    $array['data'] = $classArray;
    $array['sec'] = $sec_arr;
    
    echo json_encode($array);
	
	?>