Skip to content

Instantly share code, notes, and snippets.

@ruliarmando
Created March 11, 2014 07:04
Show Gist options
  • Select an option

  • Save ruliarmando/9480888 to your computer and use it in GitHub Desktop.

Select an option

Save ruliarmando/9480888 to your computer and use it in GitHub Desktop.
check mata kuliah
<?php
$kd_matkul = 'ABC'; // ini bisa diambil dari inputan atau form POST
$nim = '100449983'; // ini bisa diambil dari inputan atau form POST
$query_prasyarat = "select kd_matakuliah_prasayarat from mata_kuliah where kd_matakuliah = {$kd_matkul}";
$result = mysql_query($query_prasyarat) or die('query gagal');
$row = mysql_fetch_row($result);
$query_nilai = "select bobot_nilai from nilai where nim = {$nim} and kd_matakuliah = {$row['kd_matakuliah_prasyarat']}";
$result = mysql_query($query_nilai) or die('query gagal');
$row = mysql_fetch_row($result);
if(in_array($row['bobot_nilai'], array('A', 'B', 'C', 'D')))
{
echo 'success';
}
else
{
echo 'anda tidak boleh mengambil karena belum memenuhi syarat';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment