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

$json_response = array();

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


$data = $db->fetch_custom("select * from history_pendidikan inner join jurusan on history_pendidikan.kode_jurusan=jurusan.kode_jurusan where history_pendidikan.id is not null $sem $query_jurusan and jenis_method='".$_POST['jenis_method']."' and status_error!=1");
if ($data->rowCount()>0) {
   $json_response['jumlah'] = $data->rowCount();
} else {
  $json_response['jumlah'] = 0;
}

echo json_encode($json_response);

?>
