Advertisement
cdsatrian

Nilai Siswa

Apr 17th, 2013
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.76 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Nilai Siswa</title>
  4. <link rel="stylesheet" type="text/css" href="style.css" media="screen" />
  5. </head>
  6. <body>
  7. <?php
  8. include ('admin_header.php');
  9. include ('menu_nilai.php');
  10. ?>
  11. <font color="000">
  12. <div align="left">
  13. <h3>Nilai Siswa - Masukkan Nilai Tengah Semester</h3></div>
  14. <hr size=1 width=100% align="left">
  15. </font>
  16. <div align="left">
  17. <?php
  18. include('menu_masukan_nilai.php');
  19. ?>
  20. </div>
  21. <div align="left">
  22. <?php
  23. require "koneksi.php";
  24. include "config.php";
  25. require_once 'biff-reader-2010-10-07/CompoundDocument.inc.php';
  26. require_once 'biff-reader-2010-10-07/BiffWorkbook.inc.php';
  27. $fileName = $_POST['usefile'];
  28. if (!is_readable ($fileName)) die ('Cannot read ' . $fileName);
  29. $doc = new CompoundDocument ('utf-8');
  30. $doc->parse (file_get_contents ($fileName));
  31. $wb = new BiffWorkbook ($doc);
  32. $wb->parse ();
  33. $s='';
  34. foreach ($wb->sheets as $sheetName => $sheet)
  35. {
  36. echo '<table cellspacing = "0">';
  37.   for ($row = 0; $row < $sheet->rows (); $row ++)
  38.   {
  39.     echo '<tr>';
  40.     $teks='';
  41.     for ($col = 1; $col < $sheet->cols (); $col ++)
  42.     {
  43.       $cell = (!isset ($sheet->cells [$row][$col])?$sheet->cells [$row][$col]:NULL);      
  44.       $teks.=($col==1?'':',').(isset($cell)?"'".$cell->value."'":"''");
  45.       echo (isset($cell)?'<td style = "'.$cell->style->css ().'" rowspan = "'
  46.                 .$cell->rowspan.'" colspan = "'.$cell->colspan .'">':'<td>';
  47.       echo (isset($cell->value) && !empty($cell->value)? $cell->value:'&nbsp;');
  48.       echo '</td>';
  49.     }
  50.     $query = "INSERT INTO nilai (no_induk, nama, kode_mapel, ulangan_mid, semester, kelas) VALUES ($teks)";
  51.     $s.=$query."<br>";
  52.     $hasil = mysql_query($query);
  53.   }
  54.   echo '</table>';
  55. }
  56. ?>
  57. </div>
  58. <?php
  59. include ('bawah.php');
  60. echo $s;
  61. ?>
  62. </body>
  63. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement