<?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);
 $pertemuan = $data->val($i,2);
 $pokokbahasan = $data->val($i,3);
 $subpokokbahasan = $data->val($i,4);

	
	 $query = "insert into tbperkuliahandetil (idmatakuliah, pertemuan, pokokbahasan, subpokokbahasan) values  ('$idmatakuliah', '$pertemuan', '$pokokbahasan', '$subpokokbahasan')";
	 $hasil = mysql_query($query);
	 
	}
	echo "<script>window.location='".$base."data-sap'</script>"
 
?>