//Pengaturan Nomor Urut
//cek user pilih lama
$id_jns_daftar = 1;
$maba = 1;
if( $id_jns_daftar == $maba) {
//mengambil data semester
$Semester = 1;
}else{
$Semester = 5;
}
//mengambil data urut berdasarkan prodi
$kode_jurusan = 13201;
$dataUrut = $kode_jurusan;
//Mengambil data angkatan
include "kalakay_conn.php";
$dataAngkatan = mysqli_query ($koneksi, "SELECT * FROM defautldata " );
$dataAngk = mysqli_fetch_assoc ($dataAngkatan);
$Angkatan = $dataAngk['tahun_angk'];
include "resto_conn.php";
$dataFakul = mysqli_query ($koneksi, "SELECT * FROM jurusan WHERE kode_jurusan = '$dataUrut' " );
$dataFakultas = mysqli_fetch_assoc ($dataFakul);
$Fakultas = $dataFakultas['id_fakultas'];
//mengambil data prodi
$Prodi = $dataFakultas['id_prodi'];
$kodeUnik = $Angkatan.$Fakultas.$Prodi.$Semester;
$query = mysqli_query($koneksi, "SELECT nipd FROM mhs WHERE nipd LIKE '$kodeUnik'");
$totalData = count(mysqli_fetch_array($query));
$queryNim = mysqli_query($koneksi, "SELECT max(nipd) as maxNIM FROM mhs WHERE nipd LIKE '$kodeUnik%'");
$data1 = mysqli_fetch_array($queryNim);
$idMax = $data1['maxNIM'];
$kodeUrut = (int) substr($idMax, 8, 3);
$kodeUrut++;
$nipd = $Angkatan.$Fakultas.$Prodi.$Semester. sprintf("%03s", $kodeUrut);
echo $nipd;
No comments:
Post a Comment
terimakasih telah mengunjungi blog saya.