<?php
session_start();
header('Access-Control-Allow-Origin: *');
include "../../inc/config.php";

$json_response = array();

$jurusan = $_POST['jurusan'];
if ($jurusan=='all') {
	$jurusan = "";
	if ($_SESSION['level']!=1) {
		$jurusan = "and jurusan.kode_jurusan='".$_SESSION['jurusan']."'";
	}
} else {
	$jurusan = "and jurusan.kode_jurusan='".$_POST['jurusan']."'";
}
		



$data = $db->fetch_custom("select * from mhs inner join jurusan on mhs.kode_jurusan=jurusan.kode_jurusan where mulai_smt='".$_POST['sem']."' $jurusan");

if ($data->rowCount()>0) {
   $json_response['jumlah'] = $data->rowCount();
} else {
  $json_response['jumlah'] = 0;
}

echo json_encode($json_response);

?>
