Home > Article > Backend Development > NO3 Third Reich guestbook creation process_PHP tutorial
//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]