Challenge the best guestbook source code (5)_PHP tutorial
留言信息
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_direction'];
}
$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 '
表中没有数据!
';}
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 "|前面没有留言了"; } echo " | "; $t2=$initial_record+1; echo "This page Showing comments from $t2 to $next_index out of $number_of_records Leave a message"; echo " | "; if ($next_index!=$number_of_records) { $t1="initial_record=$next_index"; $sort="sort_field=$sort_field"; $asc="sort_direction=$sort_direction"; echo " "; echo "Last $number_records_to_display messages>>"; } else { echo "There is no message behind|"; } echo " |
echo " center>
";
?>
[I want it too Message]
< ?php
echo "
echo "
"; echo "Go to page"; 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 "Pages of $number_of_pages pages"; echo " |
";
?>
body>
[The copyright of this article is jointly owned by the author and Aosuo.com. If you need to reprint, please indicate the author and source]
http://www.bkjia.com/PHPjc/316159.html

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.
