Home > Backend Development > PHP Tutorial > Guestbook Challenge the best guestbook source code (5)

Guestbook Challenge the best guestbook source code (5)

WBOY
Release: 2016-07-29 08:34:02
Original
834 people have browsed it


留言本





留言信息


      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_
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 displays page $t2 To$next_index
comments, total$number_of_recordscomments";
echo "
";
if ($next_index!=$number_of_records)
{
$t1="initial_record=$next_index";
$sort="sort_field=$sort_field";
$asc="sort_direction=$sort_direction ";
 echo "
                                                                                        using using using using                       through  ‐ off to
                         out out out out out out out out out out ' out of ’s ’ ’ s
    through ’'s way through through's' ‐ ‐ through‐‐ ‐gt;

[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 page";
if (($number_of_records % $number_records_to_display)==0)
{
$number_of_pages=$number_of_records /
}
        $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 ; 
                                                                                ;
         if ($initial_record!=$yeshu)
                                                                                                                                                                                                                                                                        through S}
ELSE
echo "[$ ii]";
}
Echo "page & lt; font color = blue & gt; $ number_of_pages & lt;/font & gt; page"; lt;/tr & gt;
";
echo "

";
?>



Free guestbook byLittle Bear provides technical support



[The copyright of this article belongs to the author and Oso.com Jointly owned, if you need to reprint, please indicate the author and source]

The above introduces the source code of the guestbook challenge for the best guestbook (5), including the content of the guestbook. I hope it will be helpful to friends who are interested in PHP tutorials.


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template