Airtel 3G latest hack for March April

Get every trick latest in advance by becoming a member of my blog.

Yes, you can be someone special,who get all ticks before audience, what you need to do is to follow some simple steps and terms and conditions, Click here to know more. Hurry, once all the state members are completed, this post will automatically be titled as Expired or Done. Last date will be posted before 30th May 2013
Naveen jain

Wednesday, 25 April 2012

How to create a guestbook showing the contents

Posted by Naveen Jain on 20:07 with No comments
First of all you need to create a index.php file and a database of 4 columns which are -
1.id (BIGINT)(index = primary) AUTO INCREMENT = true
2.name (VARCHAR 250 characters)
3.message (VARCHAR 250 characters)
4.email (VARCHAR 250 characters)
Then in index.php file write the following codes to show the guestbook-


<!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>Guestbook - home</title>
</head>
<body>
<?php
// echo all the database data
require ("connect.php");
$q = mysql_query("SELECT * FROM guestbook ORDER by id desc");
$num = mysql_num_rows ($q);
if ($q > 0){
while ($data = mysql_fetch_assoc ($q)){
$name = $data['name'];
$message = $data['message'];
$email = $data['email'];
echo "<div style='background-color:yellow'>$name says <br> $message. <a href='mailto:$email'>Mail $name</a>. <a href='report.php'>Report spam and delete</a></div><hr />";
}

}

?>
</body>
</html>



Now create connect.php file with following code-

<?php
mysql_connect ('localhost','root','naveen');
mysql_select_db ('tutorials');

?>
Now insert anything in database and you can see it working.


0 comments:

Post a Comment