fhdfhdfhdfhdfhdfhdfdfhdfhdfhdhfdfhdfhdfhd dfhdfhdfhdfhdfhdfhdfhdfdfhdfhdfhdhfdfhdfhdfhdfh
| DIR:/home/u1105814/public_html/uploads/ |
| Current File : /home/u1105814/public_html/uploads/index.php |
<!DOCTYPE html>
<html>
<head>
<title>upload</title>
<?php
include 'koneksi.php';
?>
</head>
<body>
<table>
<!--form upload file-->
<form method="post" enctype="multipart/form-data" >
<tr>
<td>Pilih File</td>
<td><input name="plafond" type="file" required="required"></td>
</tr>
<tr>
<td></td>
<td><input name="upload" type="submit" value="Import"></td>
</tr>
</form>
</table>
<?php
if (isset($_POST['upload'])) {
require('spreadsheet-reader-master/php-excel-reader/excel_reader2.php');
require('spreadsheet-reader-master/SpreadsheetReader.php');
//upload data excel kedalam folder uploads
$target_dir = "uploads/".basename($_FILES['plafond']['name']);
move_uploaded_file($_FILES['plafond']['tmp_name'],$target_dir);
$Reader = new SpreadsheetReader($target_dir);
foreach ($Reader as $Key => $Row)
{
// import data excel mulai baris ke-2 (karena ada header pada baris 1)
if ($Key < 1) continue;
$query=mysqli_query($conn,"INSERT INTO plafond_master(NO_ID,PLAFOND,ANGS,ANGS_BLN,BAA,TOTALANGS,DBR,CODE,n,PLAFOND_TTG) VALUES ('".$Row[0]."', '".$Row[1]."','".$Row[2]."','".$Row[3]."','".$Row[4]."','".$Row[5]."','".$Row[6]."','".$Row[7]."','".$Row[8]."','".$Row[9]."')");
//echo "$query";
}
if ($query) {
echo "Import data berhasil";
}else{
echo("Error description: " . $conn -> error);
}
}
?>
<h2>Data master platfond</h2>
<table border="1">
<tr>
<th>No</th>
<th>PLAFOND</th>
<th>ANGS</th>
<th>ANGS/BLN</th>
<th>BAA</th>
<th>DBR</th>
<th>CODE</th>
<th>n</th>
<th>PLAFOND_TTG</th>
</tr>
<?php
$no=1;
$data = mysqli_query($conn,"select * from plafond_master");
while($d = mysqli_fetch_array($data)){
?>
<tr>
<td><?=$no++; ?></td>
<td><?=$d['PLAFOND']; ?></td>
<td><?=$d['ANGS']; ?></td>
<td><?=$d['ANGS_BLN']; ?></td>
<td><?=$d['BAA']; ?></td>
<td><?=$d['DBR']; ?></td>
<td><?=$d['CODE']; ?></td>
<td><?=$d['n']; ?></td>
<td><?=$d['PLAFOND_TTG']; ?></td>
</tr>
<?php
}
?>
</table>
</body>
</html> |