Challenge the best message of the source code (v)

Source: Internet
Author: User
Tags execution prev require sort strlen
<title> Message Book </title>
<body bgcolor=white>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<style type= "Text/css" >

<!--
TD {Font-family: "Song Body", "serif"; font-size:9pt Font-weight:normal}
a:link {Text-decoration:none}
a:hover {color: #999999}
a:visited {text-decoration:none; Font-weight:normal}
Body {font-family: "XXFarEastFont-Arial", "Serif"; font-size:11pt}
TR {font-family: "Song Body", "serif"; font-size:11pt}
. unnamed1 {font-size:9pt; Font-weight:bold}
. p9 {font-family: "XXFarEastFont-Arial"; font-size:11pt}
. unnamed2 {font-size:11pt}
-->
</style>

<?php
Require (' config.php ');
?>


<?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 ' <p> table has no data!<p> ';}
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 "<center>";
echo "<table border=0><tr bgcolor= #f1f1f1 ><td width=24% align=left>";

if ($initial _record!=0)
{
$t 1= "initial_record= $prev _index";
$sort = "sort_field= $sort _field";
$ASC = "sort_direction= $sort _direction";
echo "<a href=" $PHP _self $asc & $sort & $t 1 ">";
echo "<< before $number _records_to_display message </a>";

}

Else
{
echo "| There is no message in front of it";

}

echo "</td><td width=52% align=center>";

$t 2= $initial _record+1;

echo "This page shows the <font color=green> $t 2</font> to <font color=green> $next _index</font>
Message, a total of <font color=blue> $number _of_records</font> message ";

echo "</td><td width=24% align=right>";

if ($next _index!= $number _of_records)

{
$t 1= "initial_record= $next _index";
$sort = "sort_field= $sort _field";
$ASC = "sort_direction= $sort _direction";
echo "<a href=" $PHP _self $asc & $sort & $t 1 ">";
echo "After $number _records_to_display message >></a>";
}
Else
{
echo "There is no message on the back |";

}

echo "</td></tr></table>";
echo "</center><p>";

?>

<center>

<a href=index.html><p>

<table border= "0", width= "0" cellspacing= "cellpadding=" 0 ">
<?php
for ($iindex =0; $iindex < $number _of_records_on_current_page; $iindex + +)
{
$record =mysql_fetch_object ($result);
Require (' display.inc ');
}

?>
</table>
</center>

<p>
<?php
echo "<center>";
echo "<table border=0><tr><td>";
echo "Go to First";

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;
$t 1= "initial_record= $yeshu";

if ($initial _record!= $yeshu)
{

echo "<a href=" $PHP _self $asc & $sort & $t 1 ">";
echo "[$ii]</a>";
}
Else
echo "[$ii]";



}












echo "page Total <font color=blue> $number _of_pages </font> page";
echo "</td></tr></table>";
echo "</center><p>";

?>

<center> free Guestbook by <a href= "http://little.oso.com.cn" > Cubs </a> provide technical support </center>


</body>



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.