Assalamualaikum wr.wb. Welcome To My Blog Copyright @rhandiki.com

Web Programing Dasar Lanjutan 2

Tugas Web Programing Dasar Lanjutan 2 :
5. Source Code Tampil hapus :

<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<table width="438"
border="1">
<tr
>
<td colspan="4" bgcolor="#99CC66"><div
align="center"><strong>TAMPIL DATA ANGGOTA </strong></div></td>
</tr
>
<tr
>
<td width="51" bgcolor="#99FFCC">
<div align="center"><strong>ID</strong></div></td>
<td width="123" bgcolor="#99FFCC">
<div align="center"><strong>Nama</strong></div></td>
<td width="162" bgcolor="#99FFCC">
<div align="center"><strong>Alamat</strong></div></td>
<td width="74" bgcolor="#99FFCC">
<div align="center"><strong>Tombol</strong></div></td>
</tr
>
<?php
$koneksi=mysql_connect("localhost","root","12345678") or die("Koneksi Gagal".mysql_error());
if($koneksi){
mysql_select_db("buku_11100457",$koneksi) or die ("Database gagal dibuka".mysql_error());
//Mejalankan Query
$sql=mysql_query("SELECT * FROM anggota",$koneksi) or die("Query Gagal".mysql_error());
while($data=mysql_fetch_array($sql)){
?>
<tr>
<td><?php echo $data['id'];?></td>
<td><?php echo $data['nama'];?></td>
<td><?php echo $data['alamat'];?></td>
<td align="center">
<a href="hapusdata.php?ID=<?php
echo $data['id'];?>">Hapus</a></td>
</tr>
<?php }} ?>
</table>
</body>
</html>
 
 
6. Source Code Hapus data :

<html>
<body>
<?php
$koneksi=mysql_connect("localhost","root","12345678")or die("Gagal konek".mysql_error());
if($koneksi){
mysql_select_db("buku_11100457",$koneksi)or die("Database gagal dibuka".mysql_error());
$ID=$_GET['ID'];
$sql="DELETE FROM anggota WHERE id='$ID'";
$qry=mysql_query($sql,$koneksi)or die("Query Gagal".mysql_error());
if($qry){
echo "Data berhasil dihapus";
include "hapustampil.php";
}
else
echo "Gagal menghapus";
exit;
}
?>
</body>
</html>
 
7. Tampilan Data dan Tampilan Hapus setelah data terhapus :