<?include "showplan.php"?>
<html>
<head>
<title>Untetled document</title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<?
 $boardid=htmlspecialchars($boardid);
if($boardid=="")||$boardid<1){
$boardid=1;
};
$conn=mysql_connect('localhost','root','');
mysql_select_db('yourdatabase');
  $text="select count(*) as planid from plan where boardid='$boardid'";
  $rs=mysql_query($text,$conn);
  $pagesize=30;
  $count=mysql_result($rs,"0","planid");
  if(!$count){
$tit="没有结果!";
$pagecount=0;
 }
else{
$pagecount=ceil($count/$pagesize);
$start=($page-1)*$pagesize;
}
};?>
</head><body bgcolor=#ecffec topmargin=2>
<a name="top"></a>
<table width=100 border=1 cellspacing=0 cellpadding=0 align="center" bordercolordard=#ffffff bordercolorlight=#00cc00>
<tr bgcolor=#66ff66>
  <td nowrap colspan=2>&gt;&gt;<a href="glod.php?boardid=<?echo boardid;?>">精华</a>
   <?if($page>1){?><a href="list.php?boardid=<?echo boardid;?>&page=1">首页</a>
    <?}else{?>首页<?};?>
  <?if($page>1){?><a href="list.php?boardid=<?echo boardid;?>&page=<?echo $page-1;?>">上页</a>
    <?}else{?>上页<?};?>
<?if($page<$pagecount){?><a href="list.php?boardid=<?echo boardid;?>&page=<?echo $page+1;?>">下页</a>
    <?}else{?>下页<?};?>
<?if($page<$pagecount){?><a href="list.php?boardid=<?echo boardid;?>&page=<?echo $pagecount;?>">尾页</a>
    <?}else{?>尾页<?};?>&nbsp;页次:
<font color=red><?echo $page;?></font>/<?echo $pagecount;?>页 共<?echo $count;?>条记录
<a href="addplan.php?boardid=<?echo $boardid;?>"target="BoardAnnounce">我要发言</a>
斑竹:<a href="mailto:<?echo $masteremail?>"<?echo $boardmaster;?></a>
版面:<a href"list.php?boardid<?echo $boardid;?>&page=<?echo $page;?>"><? echo $boardname;?></a>&lt;&lt;刷新&nbsp;&nbsp;<a href="#bottom"><img src="images/arrow_down.gif" width=9 height=19 border=0></a></td>
  </tr>
</table>
<?if(!$count){
echo "<ul>".$tit."</ul";}else{
$text="select*from plan where boardid='$boardid' order by rootid desc,layer limit $start,$pagesize";
showplan($text);
};
?><br><table width=100 border=1 cellspacing=0 cellpadding=0 align="center" bordercolordard=#ffffff bordercolorlight=#00cc00>
<tr bgcolor=#66ff66>
  <td nowrap colspan=2>&gt;&gt;<a href="glod.php?boardid=<?echo boardid;?>">精华</a>
   <?if($page>1){?><a href="list.php?boardid=<?echo boardid;?>&page=1">首页</a>
    <?}else{?>首页<?};?>
  <?if($page>1){?><a href="list.php?boardid=<?echo boardid;?>&page=<?echo $page-1;?>">上页</a>
    <?}else{?>上页<?};?>
<?if($page<$pagecount){?><a href="list.php?boardid=<?echo boardid;?>&page=<?echo $page+1;?>">下页</a>
    <?}else{?>下页<?};?>
<?if($page<$pagecount){?><a href="list.php?boardid=<?echo boardid;?>&page=<?echo $pagecount;?>">尾页</a>
    <?}else{?>尾页<?};?>&nbsp;页次:
<font color=red><?echo $page;?></font>/<?echo $pagecount;?>页 共<?echo $count;?>条记录
</td>
 </tr>
<tr>
  <td nowrap colspan=2>
    <form method="post" action="list.php" name="goto">
     转到
    <input type="text" name="page" maxlength=6 size=3>
     页
    <input type="submit" name="Submit" value="GOTO">
    <input type="hidden" name="boardid" value="<?echo $boardid;?>">
</form>
</td>
</table>
</body>
</html>

解决方案 »

  1.   

    去偶的BLOG看看~~里面有两个~~http://blog.csdn.net/intereye
      

  2.   

    <?php
    /*
     ********************************************************************
     *  Editor           :  EditPlus+ 2.11                              *
     ******************************************************************** +------------------------------------------------------------------+
     |  PHP Version 4                                                   |
     +------------------------------------------------------------------+
     |  Copyright (C) 2004-2005 All Right Reseved Pc Rookie's           |
     +------------------------------------------------------------------+
     |  Notices:                                                        |
     |  If you found any error in the source code. Then I'll hope you s-|
     |end Bug email to us. So we'll thank you very much.                |
     |                                                                  |
     |                                                                  |
     |                                                                  |
     +------------------------------------------------------------------+
     |  Website         :   http://www.5down6.net                       |
     |  Author          :   Pc Rookie's                                 |
     |  Contact Email   :   [email protected]                            |
     |  LastModify      :   2004/11/12                                  |
     +------------------------------------------------------------------+
     +------------------------------------------------------------------+
     |  FileName        :   DB.php                                      |
     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     |  Function        :   Database independent query interface        |
     +------------------------------------------------------------------+
    */class DB
    {
    var $Host        = "";   //数据库主机
    var $Database    = "";   //数据库
    var $User        = "";   //用户名
    var $Password    = "";   //密码 var $Auto_Free   = 0;    //设置为1程序结束会执行mysql_free_result()
    var $Debug       = 1;    //设置为0不显示调试信息
    var $Halt_On_Err = "yes";/*设置为"yes"终止错误并显示信息;
                               设置为"no"忽略错误;
       设置为"report"忽略错误,但是会报告错误.
                             */
    var $PConnect    = 0;    //设置为1数据库将使用mysql_pconnect持久连接

    var $linkID      = 0;    //链接标识
    var $queryID     = 0;    //查询结果标识 var $queryRow    = 0;    //SQL影响的行 //数据库链接方法
        /*
      返回值:
             链接资源标识
    */
    function DB($Host = "", $User = "", $Password = "", $Database = "")
    {
    //检查各项参数是否为空
    if(!($this -> Host == "") && !($this -> User == "") && !($this -> Database== ""))
    {
    //不为空!
    $Host     = $this -> Host;
    $User     = $this -> User;
    $Password = $this -> Password;
    $Database = $this -> Database;
    }
    else
    {
    //为空!子类定义的参数不完整
    die(SUB_CLASS_PARAMETER_IS_NOT_FULL);
    }

    //成功链接到数据库否
    if($this -> linkID == 0)
    {
    //尚未链接到数据库!链接方式选择持久链接还是普通链接
    if($this -> PConnect)
    {
    //持久链接
    $this -> linkID = @mysql_pconnect($Host, $User, $Password);
    }
    else
    {
    //普通链接
    $this -> linkID = @mysql_connect($Host, $User, $Password);
    }

    //成功链接到数据库否
    if(!$this -> linkID)
    {
    //链接失败!输出错误信息
    DB::mysql_err_msg();
    }
    else
    {
    //链接服务器成功!打开数据库失败否
    if(!@mysql_select_db($this -> Database))
    {
    //数据库不存在则建立
    if(!@mysql_query("create database ".$this -> Database));
    {
    //打开数据库失败!输出错误信息
    DB::mysql_err_msg();
    }
    }
    }
    }
    //返回成功的链接标识
    return $this -> linkID;
    } //SQL语句执行方法
    /*
      返回值:
             SQL语句影响的总行数
             SQL对任何行没产生影响则返回字符串
    */
    function query($SQL = "")
    {
    //SQL语句为空否
    if($SQL == "")
    //为空!SQL语句为空
    die(SQL_ERR_MSG_SQL_IS_EMPTY);
    else
    {
    //不为空!执行SQL并将结果标识赋给$queryID
    $this -> queryID = @mysql_query($SQL);
    //SQL执行成功否
    if(!$this -> queryID)
    {
    //失败!输出错误信息
    DB::mysql_err_msg();
    }
    else
    {
    //成功!是SELECT语句否
    if(eregi("select",$SQL))
    {
    //是(SELECT)
    $this -> queryRow = @mysql_num_rows($this -> queryID);
    }
    else
    {
    //不是(是INSERT、DELETE、UPDATE)
    $this -> queryRow = @mysql_affected_rows();
    }
    //响应SQL语句的记录数为0否
    if(!($this -> queryRow))
    //返回无记录响应提示信息
    return $this -> queryRow = NOT_ANY_REC;
    }
    }
    } //获取查询操作结果集
    /*
      返回值: 
             数组Key为数据库字段名的二维数组
    */
    function rs()
    {
    //查询结果记录集为0否
    if($this -> queryRow)
    {
    //结果不为0;有符合条件记录
    //按行生成记录结果集
    $result =  mysql_fetch_object($this -> queryID);
    //按照查询结果记录集的字段总数
    for($j = 0; $j < mysql_num_fields($this -> queryID); $j++)
    {
    //依次获取字段名存入数组
    $fields = mysql_field_name($this -> queryID, $j);
    //按照[Key] => [Fields]、[Value] => [Value]赋值
    $rs[$fields] = $result -> $fields;
    }
    //返回数组
    return $rs;
    }
    } //获取分页参数的方法
    /*
      返回值:
             数组(SQL影响记录数, 定义每页显示记录数, 当前页, 总页数, 每页开始标记, 每页结束标记)
     使用:list函数获[推荐]
          list($total_rec, $page_size, $page, $total_page, $page_start, $page_end) = $obj -> splitPage($page_size, $page);   直接获取[不推荐]
    */
    function splitPage($page_size = 15,$page = 1)
    {
    //判断当前页面为第一页否
    $page ? $page = $page : $page = 1;
    //判断总记录数超过一页否
    if($page_size > $this -> queryRow)
    {
    //记录不多于一页,设置总页数
    $total_page = 1;
    //当前页起始标记值
    $page_start = 0;
    //当前页结束标记值
    $page_end = $this -> queryRow;
    }
    else
    {
    //记录总数多于一页,计算总页数
    $total_page = ceil($this -> queryRow/$page_size);
    //当前页起始标记值
    $page_start = $page_size*($page-1);
    //当前页结束标记值
    $page_end = $page_size*$page;
    //当前页为末页否
    if($page_end > $this -> queryRow)
    //为末页,更改当前页结束标记值为总记录数
    $page_end  = $this -> queryRow;
    }
    //定位数据库指针
    @mysql_data_seek($this -> queryID, $page_end);
    //返回数组
    return $split = array($this -> queryRow, $page_size, $page, $total_page, $page_start, $page_end);
    } //释放资源方法
    function free()
    {
    @mysql_free_result($this ->queryID);
    $this -> queryID = 0;
    } //错误处理方法
    function mysql_err_msg()
        {
    //获取错误代码
    $this -> errno = @mysql_errno();
    //获取错误信息
    $this -> error = @mysql_error(); //输出错误代码、信息
    $this -> print_mysql_error();
        } //错误信息输出方法[返回字符串]
    function print_mysql_error()
    {

    if($this -> Debug)
    {
    switch($this -> Halt_On_Err)
    {
    case("yes"):
    //终止程序执行并输出错误代码、信息
    die($this -> errno.":".$this -> error);
    break;
    case("no"):
    break;
    default:
    //输出错误代码、信息
    echo $this -> errno.":".$this -> error;
    break;
    }
    }
    }
    ?>
    分页参数齐全自己慢慢研究可以改造
      

  3.   

    <?php
    /*
     ********************************************************************
     *  Editor           :  EditPlus+ 2.11                              *
     ******************************************************************** +------------------------------------------------------------------+
     |  PHP Version 4                                                   |
     +------------------------------------------------------------------+
     |  Copyright (C) 2004-2005 All Right Reseved Pc Rookie's           |
     +------------------------------------------------------------------+
     |  Notices:                                                        |
     |  If you found any error in the source code. Then I'll hope you s-|
     |end Bug email to us. So we'll thank you very much.                |
     |                                                                  |
     |                                                                  |
     |                                                                  |
     +------------------------------------------------------------------+
     |  Author          :   Pc Rookie's                                 |
     |  Contact Email   :   [email protected]                            |
     |  LastModify      :   2004/17/12                                  |
     |  Update Times    :   1 Times                                     |
     +------------------------------------------------------------------+ +------------------------------------------------------------------+
     |  FileName        :   DB.php                                      |
     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     |  Function        :   Database independent query interface        |
     +------------------------------------------------------------------+
     |  Useage example:                                                 |
     |                                                                  |
     |  Step 1: Must Be Define subclass                                 |
     |  class UseAge extends DB                                         |
     |  {                                                               |
     |      //Declare your MySQL Server Parameter                       |
     |      var $Host     = "127.0.0.1"; #Host                          |
     |      var $User     = "mysql";     #User                          |
     |      var $Password = "";          #Password                      |
     |                                                                  |
     |      var $Debug    = 0;           #No Display Debug Information  |
     |   }                                                              |
     |                                                                  |
     |  Step2: Must Be Instantiation class                              |
     |  $exp = new UseAge;                                              |
     |                                                                  |
     |  Step3: Call class method                                        |
     |  $sql = "...";                                                   |
     |  $exp -> query($sql);                                            |
     |  $result = $exp -> rs();                                         |
     |                                                                  |
     +------------------------------------------------------------------+
    Example:include("DB.inc");
    class soft extends DB                                         
    {                                                               
         //Declare your MySQL Server Parameter                       
         var $Host     = "127.0.0.1"; #Host
     var $Database = "www";       #Database
         var $User     = "mysql";     #User                          
         var $Password = "";          #Password                           var $Debug    = 0;           #No Display Debug Information  
    }    $db = new soft;//截取指定字符串长度(不会将汉字截开)!
    function fixlenstr($str,$len)
    {
    $str = (string)$str;
    $len = (int)$len;
    $strlen = strlen($str);
    if($len>$strlen) $len = $strlen;
    $i = 0;
    $fixlen = 0;
    while($i<$len)
    {
    $chr = $str[$i];
    $i++;
    if(ord($chr)<0x80) $fixlen++;
    elseif($i<$len)
    {
    $i++;
    $fixlen += 2;
    }
    } return $len>=$strlen ? substr($str,0,$fixlen) : substr($str,0,$fixlen)."...";
    }
    //首页分类最新更新10条
    function getNewUpdate10($scid)
    {
    global $db;
        $sql = "SELECT ID, Name FROM down_final_class,down_info WHERE down_final_class.SCID=$scid AND down_info.FCID=down_final_class.FCID ORDER BY ID DESC"; $db -> query($sql);    if($db->queryRow)
    {
    $db -> query($sql);
    $page_size = 10;
    $page = 1; list($total_rec, $page_size, $page, $total_page, $page_start, $page_end) = $db -> splitPage($page_size, $page); for($i = $page_start; $i < $page_end; $i++)
    {
    $rs = $db -> rs($i);

    print("<li><a href=\"detail.php?id=$rs[ID]\" title=\"$rs[Name]\">".fixlenstr($rs[Name],27)."</a></li>");
    } if($db -> queryRow >= $page_size)
    print("<li class=\"more\"><a href=\"list.php?scid=$scid\">更多...</a></li>");
    }
    else
    {
    print("<li>目前该类尚无任何资源!</li>");
    }
    }*///这里修改了一次看看吧其他没有变动 //获取查询操作结果集
    /*
      返回值: 
             数组Key为数据库字段名的二维数组
    */
    function rs($seek)
    {
    //查询结果记录集为0否
    if($this -> queryRow)
    {
    //结果不为0;有符合条件记录
    //按行生成记录结果集
    @mysql_data_seek($this->queryID,$seek);
    $result =  mysql_fetch_object($this -> queryID);
    //按照查询结果记录集的字段总数
    for($j = 0; $j < mysql_num_fields($this -> queryID); $j++)
    {
    //依次获取字段名存入数组
    $fields = mysql_field_name($this -> queryID, $j);
    //按照[Key] => [Fields]、[Value] => [Value]赋值
    $rs[$fields] = $result -> $fields;
    }
    //返回数组
    return $rs;
    }
    }}
    ?>
      

  4.   

    谁帮俺解决下这个问题啊?http://community.csdn.net/Expert/topic/3658/3658856.xml?temp=.5700952
      

  5.   

    我也同问一个翻页的代码!是在html页内加入翻页效果