The process of making the message book of the 3rd Empire _ PHP Tutorial

Source: Internet
Author: User
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; $...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.