NO3 Third Reich guestbook creation process_PHP tutorial

WBOY
Release: 2016-07-21 16:02:24
Original
805 people have browsed it

//Display all messages

$conn=mysql_connect("hostname","username","password"); $db=mysql_select_db("dbname",$conn); $numcolumns=8;// Number of records displayed on each page

$query="select *from guestbook"; $result=mysql_query($query); $allnums=mysql_num_rows($result);//Calculate the number of all records $numpage= ceil($allnums/$numcolumns);//The guestbook has a total of $numpage pages

$prev=($pagenum-1)*$numcolumns; $next=$prev+$numcolumns;

if($next>=$allnums)

{ $next=$allnums; $numcolumns=$next-$prev; }//Process $prev, $next of the last page

$query="select *from guestbook order by time desc limit $prev,$next ";

$result=mysql_query($query); //Here is the guestbook page

for ($i=1;$i<=$numcolumns;$i++)

{ $row=mysql_fetch_array($result);

//Display all message pages

----------

-Bamboo reply: -According to the replyer’s ID number $id=$row['id']; $queryback="select *from gback where id=$id"; $resultback=mysql_query($queryback); $rowback=mysql_fetch_array($resultback); //Mobile reply page echo $rowback['noteback'];//Review content echo $rowback['timeback'] ;//Reply time}//ecd for

----------

Processing reply information
$conn=mysql_connect("hostname","username ","password"); $db=mysql_select_db("dbname",$conn); $query="select * from phpempire"; $result=mysql_query($query); $row=mysql_fetch_array($result);

if ($password==$row['password'])

{ $timeback=date("Y-m-d-H:i:s"); $query="insert into gback values('$ noteback','$timeback','$id')"; $result=mysql_query($query);

$message="Please wait....see all messages"; } else { $message="Sorry, only Bamboo can reply! "; }

echo $message; The empire is wonderful because of you
If the browser does not respond for a long time, please click the link here


Process the message:

$conn=mysql_connect("hostname","username","password"); $db=mysql_select_db("dbname",$conn); $time=date("Y-m-d-H:i:s"); $ ip=$REMOTE_ADDR; $query="select *from guestbook"; $result=mysql_query($query); $id=mysql_num_rows($result); $id++; $query="insert into guestbook values('$username', '$city','$email','$homepage','$note','$ip','$time',$id)"; $result=mysql_query($query);
Note: no3 Empire Guestbook
Function Introduction: Able to realize Bamboo reply and Bamboo authentication
Features: Simple structure, expandable functions
Disadvantages: Slow speed
This guestbook can be found at http://phpempire.net After seeing the running situation, if you are a little confused about some of the processes of this guestbook, please send me an email!


[The copyright of this article is jointly owned by the author and Oso.com. If you need to reprint it, please Indicate the author and source]

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316568.htmlTechArticle//Display all messages $conn=mysql_connect(hostname,username,password); $db=mysql_select_db(dbname ,$conn); $numcolumns=8;//The number of records displayed on each page $query=select *from guestbook; $...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!