Challenge the source code of the best message book (5)

Source: Internet
Author: User
& Lt; html & gt; & lt; title & gt; message book & lt;/title & gt; & lt; bodybgcolorwhite & gt; & lt; head & gt; & lt; metahttp-equivContent-Typecontenttext/html; charsetgb2312 & gt; & lt; styletypetext/
Message book





Message

Require (config. php (as the mainstream development language ));
?>




$ Initial_record = 0;
$ Sort_field = key_liuyan;
$ Sort_direction = DESC;

If (strlen ($ arr_request [initial_record])
{
$ Initial_record = $ arr_request [initial_record];
$ Sort_field = $ arr_request [sort_field];
$ Sort_direction = $ arr_request [sort_direction];

}


$ Str_ SQL _all = "select count (*) as number_of_records from $ table_name ";

$ Result = MySQL (the best combination with PHP) _ db_query ($ db_name, $ str_ SQL _all, $ id_link );

If (! Result)
{Affy_error_exit (SQL select execution has failed .);}

$ Record = @ MySQL (the best combination with PHP) _ fetch_object ($ result );

$ Number_of_records = $ record-> number_of_records;

If (strlen ($ sort_field) = 0)
{
$ Str_ SQL = "select * from $ table_name
Limit $ initial_record, $ number_records_to_display ";

}

Else
{

$ Str_ SQL = "select * from $ table_name order by $ sort_field $ sort_direction
Limit $ initial_record, $ number_records_to_display ";
}


$ Result = MySQL (the best combination with PHP) _ db_query ($ db_name, $ str_ SQL, $ id_link );

If (! $ Result)
{Affy_error_exit (SQL select execution has failed .);}

$ Number_of_records_on_current_page = @ MySQL (the best combination with PHP) _ num_rows ($ result );

If ($ number_of_records <1)
{Echo

No data in the table!

;}
Else
{
$ Next_index = $ initial_record + $ number_records_to_display;

If ($ next_index> $ number_of_records)
$ Next_index = $ number_of_records;



$ Prev_index = $ initial_record-$ number_records_to_display;

If ($ prev_index <0)
{
$ Prev_index = 0;
}

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.