Show all the messages
$c $db =mysql_select_db ("dbname", $conn); $numcolumns =8;//The number of records displayed per page
$query = "Select *from Guestbook"; $result =mysql_query ($query); $allnums =mysql_num_rows ($result);//calculation of all records $numpage =ceil ($allnums/$numcolumns);//Guestbook Total $numpage pages
$prev = ($pagenum-1) * $NUMCOLUMNS; $next = $prev + $numcolumns;
if ($next >= $allnums)
{$next = $allnums; $numcolumns = $next-$prev;} Handle the last page of $prev, $next
$query = "Select *from Guestbook ORDER BY time DESC limit $prev, $next";
$result =mysql_query ($query); Here is the guestbook page to
for ($i =1; $i <= $numcolumns; $i + +)
{$row =mysql_fetch_array ($result);
Show all the message pages
----------
-Owner reply:-According to the reply person's id number $id = $row [' id ']; $queryback = "Select *from gback where id= $id"; $resultback =mysql_query ($queryback); $rowback =mysql_fetch_array ($resultback); Owner reply page echo $rowback [' Noteback '];//review content echo $rowback [' Timeback '];//reply time}//ecd for
-----------
Handling Reply messages
$c $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 ...." Look at all the messages "; } else {$message = "Sorry, only the owner can reply!" "; }
Echo $message; The Empire is wonderful because of you.
If the browser is not responding for a long time, please click here for the connection
Processing message information:
$c $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: Can realize the owner of the reply, the owner certification
Features: simple structure, expandable function
Cons: Slow speed
This guestbook can see the running situation in Http://phpempire.net, if you are a bit dizzy for some of the process of this guestbook send me email!
"The copyright of this article is owned by the author and house Orso near net, if need to reprint, please specify the author and source"
The above describes the Red Alert 2 Third Reich NO3 The third Empire of the book making process, including the Red Alert 2 The Third Reich content, I hope to be interested in PHP tutorial friends helpful.