function UsmSav() { $md = $_REQUEST['md'] + 0; $Nama = sqling($_REQUEST['Nama']); $Keterangan = sqling($_REQUEST['Keterangan']); $NA = empty($_REQUEST['NA']) ? 'N' : $_REQUEST['NA']; if ($md == 0) { $s = "update pmbusm set Nama='{$Nama}', Keterangan='{$Keterangan}', NA='{$NA}'\r\n where PMBUSMID='{$_REQUEST['PMBUSMID']}' "; $r = _query($s); } else { $PMBUSMID = $_REQUEST['PMBUSMID']; $ada = GetFields('pmbusm', 'PMBUSMID', $PMBUSMID, '*'); if (!empty($ada)) { echo ErrorMsg("Gagal Simpan", "Kode test <b>{$PMBUSMID}</b> telah digunakan oleh test:<br>\r\n <b>{$ada['Nama']}</b>. Gunakan kode test lain."); } else { $s = "insert into pmbusm(PMBUSMID, Nama, Keterangan, NA)\r\n values('{$_REQUEST['PMBUSMID']}', '{$Nama}', '{$Keterangan}', '{$NA}')"; $r = _query($s); } } DefUSM(); }
function DelUSM() { $s = "update pmb set RuangID=NULL, NomerUjian=0 where PMBID='{$_REQUEST['pmbid']}'"; $r = _query($s); DefUSM(); }