<?php 
	class DataSoal extends mysql{
		
		function get_hasil_ujian($kolom,$a,$type, $tahun){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "select tb1.*, tb2.Nama, tb2.Jurusan from tbrekapujian tb1 INNER JOIN tbpendaftaran tb2 on tb1.NoPendaftaran = tb2.NoPendaftaran where substring(tb1.NoPendaftaran, 1, 2) = '".$tahun."'";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}

		function get_pendaftaran_single_by_id($kolom,$id){
			if($this->cek_result != "on"){
			$sql = "SELECT * FROM tbpendaftaran WHERE NoPendaftaran ='".$id."'";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}

		function get_all_soal($kolom,$a,$type){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "select * from tbsoal order by rand()";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}

		function simpan($NoPendaftaran, $id, $jawaban, $hasiljawaban){
			  $sql = "insert into tbhasilujian (NoPendaftaran, id, jawaban, hasilJawaban) values ('".$NoPendaftaran."', '".$id."', '".$jawaban."', '".$hasiljawaban."')";
			  $this->query = $this-> execute($sql,''); 
		}
		function simpan_hasil($NoPendaftaran, $Nilai, $Keterangan){
			  $sql = "insert into tbrekapujian (NoPendaftaran, Nilai, Keterangan, tanggal) values ('".$NoPendaftaran."', '".$Nilai."', '".$Keterangan."', now())";
			  $this->query = $this-> execute($sql,''); 
		}
		function delete_ujian($id){
			  $sql = "delete from tbrekapujian where id = '".$id."'";
			  $this->query = $this-> execute($sql,''); 
		}
		
		
	}
?>