Studi Kasus : Membuat guestbook sederhana dengan PHP Mysql
Kebutuhan : Webserver Packages, already installed.
Ok, langsung praktik saja.
Step 1 : Persiapkan Database
- Buat database dengan nama db_tutorial
- Siapkan tabel dengan nama tb_guestbook, dengan struktur tabel seperti gambar dibawah ini.
- Done!
Step 2 : Persiapkan Folder Kerja
- Buat folder dengan nama tutorphp dalam document root anda
- Simpan semua file dalam tutorial ini dalam folder tersebut.
Step 3 : Membuat script koneksi ke Database
- Ketikkan script berikut,
[sourcecode language=”php”]
<?php
$host = "localhost";
$user = "root";//adjust according to your mysql setting
$pass = ""; //adjust according to your mysql setting, i use no password here
$dbName = "db_tutorial";
mysql_connect($host, $user, $pass);
mysql_select_db($dbName)
or die ("Connect Failed !! : ".mysql_error());
?>
[/sourcecode] - simpan dengan nama connect.php
Step 4 : Membuat form guestbook
- Ketikkan script berikut,
[sourcecode language=”php”]
<h1>Guestbook</h1>
<form method="post" action="savegb.php">
<table>
<tr><td>Your Name</td><td></td></tr>
<tr><td>Your Email</td><td></td></tr>
<tr><td>Your Comment</td><td><textarea name="comment"></textarea></td></tr>
<tr><td></td><td></td></tr>
</table>
</form>[/sourcecode]
- simpan dengan nama formguestbook.php
Step 5 : Membuat script pemrosesan dan menampilkan guestbook
- Ketikkan script berikut,
[sourcecode language=”php”]
<?php
include ‘connect.php’;$name = $_POST[‘name’]; //get the name value from form
$email = $_POST[‘email’]; //get the email value from form
$comment = $_POST[‘comment’]; //get the comment value from form//query to save to database
$q1 = "INSERT into tb_guestbook value (”,’$name’,’$email’,’$comment’)";
$result1 = mysql_query($q1);//query to get data from database
$q2 = ‘SELECT * FROM tb_guestbook order by id desc’;
$result2 = mysql_query($q2);//show the data from database
while ($record = mysql_fetch_array($result2)) {
echo "<table>";
echo "<tr><td>Name</td><td>:</td><td>".$record[‘name’]."</td></tr>";
echo "<tr><td>Email</td><td>:</td><td>".$record[‘email’]."</td></tr>";
echo "<tr><td>Comment</td><td>:</td><td>".$record[‘comment’]."</td></tr>";
echo "</table>";
echo "<br/>";
}
?>
[/sourcecode] - simpan dengan nama savegb.php
- untuk penjelasan script, lihat komentar pada script 😀
Step 6 : Testing Code
- Pergi ke http://localhost/tutorphp/formguestbook.php. Anda akan melihat form seperti dibawah. Isikan guestbook tersebut (misal seperti pada gambar dibawah)
- Klik tombol save dan anda akan melihat hasilnya
OK. Haaaaaaaapppy Coding! 😀
38 replies on “GuestBook Sederhana dengan PHP & Mysql”
DIM STUDIO – SEO
спасибо интересное чтиво
Решила написать в ветку форума, прошу булыжниками не закидывать, Вашему вниманию сайт: порно на ночь короче посмотреть ) Надеюсь понравится он =)
Exactly what are the Most Essential Characteristics of the Best Courting Internet site?
Picking the best courting site on the net isn’t always as easy as it may sound. Each online dating internet site https://blogcitynews.com has many different capabilities that each person might want. So how do you find the best go with and what features are crucial to you?
Internet dating sites like MySlate, Go with, Fast Singles, and Dater do each of the do the job. They bring together members of varied qualification and find suitable singles. It’s really much like searching in the woods. You have to make use of intuition and knowledge of the ground to get the appropriate match.
Online dating services websites will typically make use of an algorithm formula to fit you with potential complements based on stuff like your sex, grow older, size, excess weight, faith, training, ethnicity, plus more. For those who have been out with a man that is over weight, your web account might read “Not just a Health Nut,” or you could find an overweight person messaging you consistently. Every person’s online information can vary. It’s information on getting yourself with your customers boots and which makes them comfy.
Спасибо за пост
_________________
Игровой автомат книга ра игровые автоматы играть бесплатно
Thanks, long searched
_________________
Online casino book of dead freispiele
buy software cheap
Thank’s….. blogwalking bos!
Search Engine Optimization
Artikel menarik…. tp mumet jg kalo yang masih pemula. Thank’s bro..!
Media informasi seputar job
Script Buku tamu ini kalo diterapin di blogspot bisa gk bos…?
info perumahan daerah bandung
Wih bener bener keren banget
http://www.forum.strategium.eu/showthread.php?tid=293330 Черепашки-ниндзя 2 На андроид видео про полный фильм
http://ideaventures.in/forum/showthread.php?tid=618 кино 2016 года смотреть онлайн
http://schk.su/forum/viewtopic.php?pid=52077#p52077 Игра престолов 6 сезон 5 серия 3 2016 полный фильм
http://softcom.free.fr/showthread.php?p=821597&posted=1#post821597 Алиса в Зазеркалье На телефон смотреть без
http://www.demonhost.cl/islandcraft/index.php?topic=154423.msg330855#msg330855 Черепашки-ниндзя 2 На андроид смотреть х ф полный фильм
http://www.keyifhane.me/forum/viewtopic.php?pid=144251#p144251 Черепашки-ниндзя 2 В хорошем качестве HD 720 скачать торрент rutor
А я нашел классный секс шоп с донельзя хорошими ценами и быстрой доставкой по всей России. Вот делюсь ссылкой http://pozdravhappy.ru – ЗДЕСЬ
http://tanzhusaren.de
.
Ораторское чавканье является, если, и только если разрешившийся перезвон благочинно бурит пеленание ненагретыми богадельнями. Коллоквиум является хвостатой гипотермией.
http://norrprocenos1988.byethost10.com/
Thanks for the share!
Cheap True Religion
nettikasino bonukset suomalaisia nettikasinoita 10 ilmaista pelirahaa
mantap gan. ijin nyoba
error program..!!
It’s OK http://yjukaukekem.de.tl kdz bbs this was good but reminds me of lays with girls that really want try be sexy but try too hard to be pornstars…Yes I realise the irony of that but if you get what I’m saying you’ll realise I’m right.
I’d like to take the job http://alemisyfydo.lefora.com/2012/03/12/japan-girl-lol-bbs/ preteen females lolitas pictures I couldn’t take her seriously if she said shit and had an accent like that while she sucked my cock. …If I had one, that is.
[url=http://multfilms.tv/]Мультфильмы[/url]
[url=http://multfilms.tv/multfilm.php?id=1664]Мультфильм Ну погоди[/url]
[url=http://multfilms.tv/multfilm.php?id=352]Смотреть онлайн мультфильм Вини пух[/url]
[url=http://multfilms.tv/multfilm.php?id=857]мультфильм золушка смотреть[/url]
wahh bgus sekali infonya, termia kasih udah membantuku memahami cara membuat comment box. My website : http://kevinsite.netii.net/
Your Site Is Great, bactrim [url=http://intensedebate.com/people/bactrima#1]bactrim[/url], 662,
kalo bikin tutor yg lengkap mas, kaya ga niat ckckck, kasihan yg pemula di bikin pusing, ngasih ilmu jgn setengah-setengah aku tau itu ada scipt yg kurang.. kebangetan juga nih kalo post ku ini ga di accept wkakwk
(lmao)
hehehehe ini yg bikin script sengaja gak masukin table.text nya ya heheheheheh (applause)
ah itu coment yg di atas tanda2 orang belum mengerti script belajar dulu lah HTML baru belajar php ngerti dulu script baru coment punya orang udah bagus dy mau posting
gak jalan scriptnya,,malah bkin pusing (idiot) (taser) X-(
GAk jalan gitu scriptnya
Hi!
Is there something interesting?
untuk script formguestbook.php sepertinya masih belum lengkap, karna hanya menampilkan satu form saja, dan tombol submitnya juga belum ada, mungkin bisa menggunakan script dibawah ini untuk lebih lengkapnya:
===================================================
Guestbook
Your Name:
:
Your Email
:
Your Comment
:
:
semoga berhasil (scenic)
Wuih…selama ini ane cuma bisa make plugin. Coba2 belajar make skrip kaya ente ah , Thanks Berat Sob atas inponya
waduh, berantakan banget scriptnya bos, ga bisa dibuat lebih rapi bos, biar gampang dibaca