#INDEX
Ketik atau copas coding berikut.
Pastikan sudah pasang XAMPP. karena saya pakai XAMPP.
save Index.php di :
C > PROGRAM FILE > XAMPP > HTDOCS
<html>
<head>
<title>Daftar Mahasiswa</title>
</head>
<body>
<?php
$sambung=mysql_connect("localhost","root","") or die ("Gagal konek gaes ke servernya");
mysql_select_db("master_barang") or die ("Gagal membuka Database");
?>
<table border="5">
<tr>
<th>Id Barang</th>
<th>Nama Barng</th>
<th>Jenis</th>
<th>Satuan</th>
<th>Keterangan</th>
<th colspan="3">Aksi</th>
</tr>
<?php
$query = "select * from barang";
$result = mysql_query($query,$sambung);
//$no = 0;
while ($buff = mysql_fetch_array($result)){
//$no++;
?>
<tr>
<td><?php echo $buff['idbarang']; ?></td>
<td><?php echo $buff['namabarang']; ?></td>
<td><?php echo $buff['jenis']; ?></td>
<td><?php echo $buff['satuan']; ?></td>
<td><?php echo $buff['keterangan']; ?></td>
<td><a href="edit.php?idbarang=<?php echo $buff['idbarang']; ?>">Edit</a></td>
<td><a href="hapus.php?idbarang=<?php echo $buff['idbarang']; ?>">Hapus</a></td>
</tr>
<?php
}
mysql_close($sambung);
?>
</table>
<p align="left"><a href="tambah.php">Tambah Data</a></p>
</body>
</html>