The process of making the message book of the 3rd Empire. Show all messages $ connmysql_connect (hostname, username, password); $ dbmysql_select_db (dbname, $ conn); $ numcolumns8; number of records displayed on each page $ queryselect * fromguestbook; $ // 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 total number of records $ numpage = ceil ($ allnums/$ numcolumns); // There are $ numpage pages in the message book
$ Prev = ($ pagenum-1) * $ numcolumns; $ next = $ prev + $ numcolumns;
If ($ next> = $ allnums)
{$ Next = $ allnums; $ numcolumns = $ next-$ prev;} // process the last page $ prev, $ next
$ Query = "select * from guestbook order by time desc limit $ prev, $ next ";
$ Result = mysql_query ($ query); // the message book page
For ($ I = 1; $ I <= $ numcolumns; $ I ++)
{$ Row = mysql_fetch_array ($ result );
// Display all message pages
----------
-Bamboo reply:-according to the id of the respondent $ id = $ row ['id']; $ queryback = "select * from gback where id = $ id "; $ resultback = mysql_query ($ queryback); $ rowback = mysql_fetch_array ($ resultback); // return the page echo $ rowback ['noteback']; // review content echo $ rowback ['timeback']; // response time} // MCM
-----------
Process 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... check all the messages";} else {$ message = "Sorry, you can reply only to bamboo! ";}
Echo $ message; the Empire is wonderful because of you.
If the browser does not respond for a long time, click connection 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: Empire message book
Function description: it can implement the reply and authentication of bamboo.
Features: simple structure and scalable functions
Disadvantage: slow speed
This guestbook can be viewed at Http: // phpempire.net. if you are confused about some processes in this guestbook, please send me an email!
[This article is copyrighted by the author and osuo. if you need to reprint it, please indicate the author and its source]
Counter $ 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; $...