Tabel Tamu (Simpan Dengan Nama buku_tamu) |
Gambar 1.0 Ketika Button Simpan Diclick Maka Tampil Seperti Gambar 2.0 |
Gambar 2.0 Ketika Click "Lihat Data" Maka Tampil Seperti Gambar 3.0 Ketika Click "Kembali" Maka Tampil Seperti Gambar 1.0 |
Gambar 3.0 Ketika Click "Edit" Maka Tampil Seperti Gambar 4.0 Ketika Click "Delete" Maka Tampil Seperti 5.0 Ketika Click "Kembali Input Buku" Tampil Seperti Gambar 1.0 |
Gambar 4.0 Ketika Button Update Diclick Maka Tampil Seperti Gambar 4.1 |
Gambar 4.1 Ketika Click "Edit" Maka Tampil Seperti Gambar 4.0 Ketika Click "Delete" Maka Tampil Seperti Gambar 5.0 Ketika Click "Kembali Input Buku" Maka Tampil Seperti Gambar 1.0 |
Coding/Listing Koneksi (Simpan Dengan Nama koneksi.php) :
<?php
$koneksi=mysql_connect("localhost","root","password") or die(mysql_error());
mysql_select_db("latihan_sql",$koneksi) or die (mysql_error());
?>
Coding/Listing Gambar 1.0 (Simpan Dengan Nama latihan_input.php) :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="latihan_insert.php" method="post">
<h1 align="center"><font face="Castellar">Input Buku Tamu</font></h1>
<br />
<table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td> NIM</td>
<td> <input name="nim" type="text" size="10" maxlength="10" /></td>
</tr>
<tr>
<td> Nama</td>
<td> <input name="nama" type="text" size="30" maxlength="30" /></td>
</tr>
<tr>
<td> Email</td>
<td> <input name="email" type="text" size="20" maxlength="20" /></td>
</tr>
<tr>
<td valign="top"> Komentar</td>
<td> <textarea name="komentar" cols="25" rows="5"></textarea></td>
</tr>
<tr>
<td colspan="2" align="center"> <input name="bsimpan" type="submit" value="Simpan" />
<input name="breset" type="reset" id="breset" value="Batal" /></td>
</tr>
</table>
</form>
</body>
</html>
Coding/Listing Gambar 2.0 (Simpan Dengan Nama latihan_insert.php) :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
include "koneksi.php";
$perintah=mysql_query("insert into buku_tamu(nim,nama,email,komentar)values('$nim','$nama','$email','$komentar')",$koneksi) or die (mysql_error());
echo "<h3><marquee>Terima Kasih $nama, Komentar Anda Sanga Kami Harapkan</h3></marquee>";
?>
<br />
<br />
<br />
<a href="tampil_latihan.php">Lihat Data</a>
<a href="latihan_input.php">Kembali</a>
</body>
</html>
Coding/Listing Gambar 3.0 (Simpan Dengan Nama tampil_latihan.php) :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
include "koneksi.php";
$hasil=mysql_query("select * from buku_tamu",$koneksi);
$jumlah=mysql_num_rows($hasil);
echo "Jumlah Tamu:$jumlah";
echo "<br><br>";
echo "<table border=1>
<tr>
<th>NIM</th>
<th>Nama</th>
<th>Email</th>
<th>Komentar</th>
<th>Action</th>
</tr>";
while($row=mysql_fetch_array($hasil))
{
echo "<tr>";
echo "<td>$row[nim]";
echo "<td>$row[nama]";
echo "<td>$row[email]";
echo "<td>$row[komentar]";
echo "<td><a href=edit.php?nim=$row[0]>Edit</a> <a href=delete.php?nim=$row[0]>Delete</a></td>";
echo "</tr>";
}
echo "</table>";
?>
<br />
<a href="latihan_input.php">Kembali Input Buku</a>
</body>
</html>
Coding/Listing Gambar 4.0 (Simpan Dengan Nama edit.php) :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
include "koneksi.php";
$hasil=mysql_query("select * from buku_tamu where nim='$nim'",$koneksi) or die(mysql_error());
while($row=mysql_fetch_array($hasil))
{
echo "<form method=post action=update.php>";
echo "<pre>";
$nim=$row["nim"];
$nama=$row["nama"];
$email=$row["email"];
$komentar=$row["komentar"];
echo "NIM : <input type=text size=10 name=nim value=$nim><br>";
echo "Nama : <input type=text size=30 name=nama value=$nama><br>";
echo "Email : <input type=text size=25 name=email value=$email><br>";
echo "Komentar : <textarea rows=4 cols=25 name=komentar>$komentar</textarea><br>";
echo "<input type=submit value=Update>";
echo "</pre>";
echo "</form>";
}
?>
</body>
</html>
Coding/Listing Gambar 4.1 (Simpan Dengan Nama update.php) :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
include "koneksi.php";
$hasil=mysql_query("update buku_tamu set nama='$nama',email='$email',komentar='$komentar' where nim='$nim'",$koneksi) or die(mysql_error());
echo "Data Telah Diperbaharui";
include ("tampil_latihan.php");
?>
</body>
</html>
Coding/Listing Gambar 5.0 (Simpan Dengan Nama delete.php) :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
include "koneksi.php";
$query=stripslashes($query);
$query=mysql_query("delete from buku_tamu where NIM='$nim'",$koneksi) or die(mysql_error());
if($query)
echo "<h2>Data Dengan nim=$nim Telah Terhapus</h3>";
include ("tampil_latihan.php");
?>
</body>
</html>
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :