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

$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']."'";
}

$json_response = array();


$data = $db->fetch_custom("select prestasi_mahasiswa.id as id_kelas,prestasi_mahasiswa.*,jurusan.kode_jurusan from prestasi_mahasiswa inner join jurusan on prestasi_mahasiswa.kode_jurusan=jurusan.kode_jurusan where status_error!=1 $jurusan");
if ($data->rowCount()>0) {
   $json_response['jumlah'] = $data->rowCount();
} else {
  $json_response['jumlah'] = 0;
}

echo json_encode($json_response);

?>
