Xinlin record (7)

Source: Internet
Author: User
Message book part: & nbsp; class member message book: show message: class/notebook/index. php (as the mainstream development language) & lt ;? Session_start (); // start sessionif (! Session_is_registered (userregister) | (& #36; userreg; guestbook part:
Class Member message book: displays a message: class/notebook/index. php (as the mainstream development language)
Session_start (); // start session
If (! Session_is_registered ("userregister") | ($ userregister = "") // check whether it is registered. if userregister is not registered or the session is null, register it again.
{
Echo "(as the current mainstream development language)> Please register again
";
Exit;
}
?>



Message book



Include ("../config. php (as the mainstream development language )");
$ Result = MySQL (the best combination with PHP) _ query ("SELECT * FROM notebook", $ db );
$ Row = MySQL (the best combination with PHP) _ num_rows ($ result); // You can check the number of rows in the query result.
$ Max = $ row; // total number of posts
// Set 10 entries per page. you can set the total number of pages on $ p, the number of pages on $ page, and the number of rows on $ low.
If (! $ Page) {$ page = 1;} // The default value of $ page is 1.
$ P = ceil ($ max/10); // The maximum number of pages is the maximum integer of $ max/10.
$ Low = 10 * ($ page-1 );
If ($ page = $ p & ($ max % 10) <> 0) {$ x = ($ max % 10);} else {$ x = 10 ;} // if the last page is not an integer multiple of 10, read the remainder of $ max divided by 10. Otherwise, take 10.
If ($ max = 0) {$ x = 0;} // if there is no post, set $ x to 0.
$ Result = MySQL (the best combination with PHP) _ query ("select * from notebook order by time DESC limit $ low, $ x", $ db ); // query by post time in descending order
?>














(As the mainstream development language) "class =" white12 "> homepage

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.