<?php
 //menggunakan class phpExcelReader
 include "reader.php";
 
$host='localhost';
$username='root';
$password='';
$database='mhs';
mysql_connect($host,$username,$password);
mysql_select_db($database);
 
 $data = new Spreadsheet_Excel_Reader($_FILES['userfile']['tmp_name']);
 $baris = $data->rowcount($sheet_index=0);
 
 for ($i=2; $i<=$baris; $i++) {
 $idmatakuliah = $data->val($i,1);
 $matakuliah = $data->val($i,2);
 $dosen = $data->val($i,3);
 $sks = $data->val($i,4);
 $semester = $data->val($i,5);
 $jurusan = $data->val($i,6);
 $kelas = $data->val($i,7);
 $hari = $data->val($i,8);
 $ruang = $data->val($i,9);
 $waktu = $data->val($i,10);
 $sm = $data->val($i,11);
 $tahun = $data->val($i,12);

 	
	 $query = "INSERT INTO tbuas (idmatakuliah, matakuliah, dosen, sks, semester, jurusan, kelas, hari, ruang, waktu, sm, tahun, hadir, seharusnya, tidakhadir, tambahan ) values ('$idmatakuliah', '$matakuliah', '$dosen', '$sks', '$semester', '$jurusan', '$kelas', '$hari', '$ruang', '$waktu', '$sm', '$tahun', 0, 0, 0, 0)";
	 $hasil = mysql_query($query);
	 
	}
	echo "<script>window.location='".$base."data-uas'</script>"
 
?>