Nomor 2
<?php
$query = $koneksi->query("SELECT * FROM barang");
$i = 1;
?>
<h1>Tampil Data Barang</h1>
<table border=1>
<tr>
<td>No</td>
<td>Kode Barang</td>
<td>Nama Barang</td>
<td>Harga</td>
<td>Aksi</td>
</tr> <?php
while ($data = $query->fetch_array())
{
$kode = $data['KdBrg'];
echo "
<tr>
<td>" . $i++ . "</td>
<td>" . $data['KdBrg'] . "</td>
<td>" . $data['NmBrg'] . "</td>
<td>Rp." . number_format($data['Harga'],0,",",".") . ",-</td>
<td><a href='index.php?hal=ubah.php&kode=$kode'>Ubah</a> | <a href='index.php?hal=hapus.php&kode=$kode'>Hapus</a> </td>
</tr>";
} ?>
</table>