您的位置:首页网页设计PHP实例 → 挑战最棒的留言本的源码(五)

挑战最棒的留言本的源码(五)

时间:2004/11/7 3:24:00来源:本站整理作者:蓝点我要评论(0)



留言本











留言信息






      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 "本页显示第 $t2$next_index

条留言,共$number_of_records条留言";



echo "
";



if ($next_index!=$number_of_records)



  {

     $t1="initial_record=$next_index";

     $sort="sort_field=$sort_field";

     $asc="sort_direction=$sort_direction";

     echo "    ";

     echo "后 $number_records_to_display 条留言>>
";

  }  

else

  {

     echo "后面没有留言了|";



  }



echo "
";

echo "

";



?>







[我也要留言]










for ($iindex=0;$iindex<$number_of_records_on_current_page;$iindex++)

{

$record=mysql_fetch_object($result);

require('display.inc');

}



?>










echo "

";

echo "
";

echo "转到第";



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 "页  共 $number_of_pages 页";

echo "
";

echo "

";



?>






免费留言本由小熊提供技术支持














【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】    


相关阅读 Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么

文章评论
发表评论

热门文章 没有查询到任何记录。

最新文章 我的php文件怎么打开_php运算符怎么写 php 如何生成静态页面的函数PHP生成图片缩略图PHP session常见问题集锦及解决办法PHP实现同步远程Mysql

人气排行 DEDE在文章列表文章没有缩略图的不显示图片php+mysq修改用户密码我的php文件怎么打开_如何打开php文件的办法FCKeditor的配置和使用方法使用dedecms建站教程PHP+Ajax实现分页技术图片存储与浏览一例Linux+Apache+PHP+MySQLPHP生成图片缩略图