Challenge the source code of the best message book (5 ). Htmltitle message book titlebodybgcolorwhiteheadmetahttp-equivContent-Typecontenttexthtml; charsetgb2312styletypetextcss! -- Td {font-family:, serif; font-size: 9
Message book
Message
Require ('config. php ');
?>
$ 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 _ ction '];
}
$ Str_ SQL _all = "select count (*) as number_of_records from $ table_name ";
$ Result = mysql_db_query ($ db_name, $ str_ SQL _all, $ id_link );
If (! Result)
{Affy_error_exit ('SQL select execution has failed .');}
$ Record = @ mysql_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_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_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;
}
}
Echo"
";
Echo"
";
If ($ initial_record! = 0) { $ T1 = "initial_record = $ prev_index "; $ Sort = "sort_field = $ sort_field "; $ Asc = "sort_direction = $ sort_direction "; Echo ""; Echo "< <前 $number_records_to_display 条留言"; } Else { Echo "| there is no message above "; } Echo" |
";
$ T2 = $ initial_record + 1;
Echo "the section $ t2 to $ next_index is displayed on this page. Messages, total $ number_of_records messages ";
Echo" |
";
If ($ next_index! = $ Number_of_records)
{ $ T1 = "initial_record = $ next_index "; $ Sort = "sort_field = $ sort_field "; $ Asc = "sort_direction = $ sort_direction "; Echo ""; $ Number_records_to_display comment after echo "> "; } Else { Echo "no message left behind | ";
}
Echo" |
";
Echo"
";
?>
[I also want to leave a message]
For ($ iindex = 0; $ iindex <$ number_of_records_on_current_page; $ iindex ++){$ Record = mysql_fetch_object ($ result );Require ('display. Inc ');}?>
Echo"
";
Echo"
"; Echo "go to ";
If ($ number_of_records % $ number_records_to_display) = 0) { $ Number_of_pages = $ number_of_records/$ number_records_to_display;
}
Else { $ Number_of_pages = ($ number_of_records-($ number_of_records % $ number_records_to_display)/$ number_records_to_display + 1;
}
$ Sort = "sort_field = $ sort_field "; $ Asc = "sort_direction = $ sort_direction ";
For ($ ii = 1; $ ii <= $ number_of_pages; $ ii ++)
{ $ Yeshu = ($ II-1) * $ number_records_to_display; $ T1 = "initial_record = $ yeshu ";
If ($ initial_record! = $ Yeshu) {
Echo ""; Echo "[$ ii]"; } Else Echo "[$ ii]";
}
Echo "page $ number_of_pages "; Echo" |
";
Echo"
";
?>
Technical support provided by Cubs for free message Books
[This article is copyrighted by the author and osuo. if you need to reprint it, please indicate the author and its source]
Http://www.bkjia.com/PHPjc/316159.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/316159.htmlTechArticlehtml title message body bgcolor = white head meta http-equiv = Content-Type content = text/html; charset = gb2312 style type = text/css! -- Td {font-family:, serif; font-size: 9...