Postingan lainnya
mysqli_query() expects parameter 1 to be mysqli
Ada yang bisa Bantu gan ???
0
5 Jawaban:
coba function.php di share codenya... kurang jelas gan gambarnya
0
Sepertinya file init.php nya belum agan require_one sehingga koneksi ke database tidak tersambung gan
0
function.php
function ambilData(){
global $link;
$pilih = "SELECT * FROM siswa";
$result = mysqli_query($link,$pilih);
return $result;
}
0
delete.php
require_once 'function.php';
if (isset($_GET['id'])) {
if (hapusData($_GET['id'])) {
header('Location: ../index.php');
}else{
echo "hapus data gagal bukan di fungsi";
}
}
0
index nya
<html>
<head>
<title>Sistem Informasi Siswa</title>
<!--Link-->
<link rel="stylesheet" href="style/bootstrap.css">
<link rel="stylesheet" href="style/style.css">
</head>
<body>
<div class="container-fluid">
<div class="panel panel-primary">
<div class="panel-heading text-center">Data Siswa XI TKJ 2</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-bordered">
<tr>
<td class="text-center"><strong>Nama</strong></td>
<td class="text-center"><strong>Alamat</strong></td>
<td class="text-center"><strong>Tempat, Tanggal Lahir</strong></td>
<td class="text-center"><strong>Aksi</strong></td>
</tr>
<?php
$result=ambilData();
while ($row=mysqli_fetch_assoc($result))
{
?>
<tr>
<td><?php echo $row['nama']; ?> </td>
<td><?php echo $row['alamat']; ?></td>
<td><?php echo $row['tempat_lahir'].",".$row['tanggal']." ".$row['bulan']." ".$row['tahun']; ?> </td>
<td class="text-center">
<a href="inc/update.php?id=<?php echo $row['id']; ?>" class="btn btn-primary">
Edit
</a>
<a href="inc/delete.php?id=<?php echo $row['id']; ?>" class="btn btn-danger">
Delete
</a>
</td>
</tr>
<?php
}
?>
</table>
</div>
</div>
</div>
</div>
</body>
</html>
0