求php大虾帮忙...不胜感激

请教php长文章分页的问题~news_article.php这是文章内容显视页
<?php
if ($id=$_GET['n_id']){//获取新闻id
        
include_once('include/config.php');
include_once('include/mysql_page.php');

$db=new mysql($dbhost,$dbuser,$dbpwd);
$db->select($dbname);
$sql="select *from news_type";//获取新闻类型
$query=$db->query($sql);
$new_sql="select *from news where n_id=$id";//获取n_id的新闻内容
$new_query=$db->query($new_sql);
$new_row=$db->fetch_array($new_query);

?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" c />
<title><?php echo $new_row['n_title']?></title>
<link href="css/css.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="menu"><ul id="nav"><?php while($row=$db->fetch_array($query)){
?>
    <li><a href="news_list.php?t_id=<?php echo $row[0]?>&t_type=<?php echo $row[1]?>"><?php echo$row[1];?></a></li><?php }?><!--栏目输出-->
   </ul>
</div>
<div id="head"></div>
<div id="main"><div id="sidebar">
  <table width="180" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td height="48"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" style="overflow:hidden;">
        <tr>
          <td style="padding-left:15px; padding-top:5px; border-bottom:1px #006666  solid;"></td>
        </tr>
        <tr >
          <td ><ul id="new" ><?php $sql="select n_id,n_title from news order by n_data desc limit 0,6 ";
          $query=$db->query($sql);
          while ($row=$db->fetch_array($query)) {
                  
        ?>
            <li> <font color=red><新></font><a href="news_article.php?n_id=<?php echo $row['n_id']?>"><?php echo $row['n_title']?></a></li><?php }?>//最新新闻....
                  </ul></td>
        </tr>
      </table></td>
    </tr>
    <tr>
      <td height="2" > </td>
    </tr>
    <tr>
      <td height="29"> </td>
    </tr>
  </table>
</div>
<div id="mainbody">
  <h2><?php echo $new_row['n_title']?></h2>//新闻内容....
<ul class="beizhu">
  <li>来源: <?php echo $db->html($new_row['n_source']) ?></li>
  <li>作者 :<?php echo $db->html($new_row['n_author']) ?></li>
  <li>时间: <?php echo $new_row['n_data']?></li>
</ul><p>
  <?php echo $db->html($new_row['n_content'])?>//正文如何分页....
</p>
</div>
</div>
<div id="footer"></div>
</body>
</html>
<?php }?>
我有分页代码如下....在普通情况下。可以实现。。
但是由于上边页的代码每次都要读取n_id的值并调用数据库的数据。。。
使得page上出现错误.....
故小弟在文章分页上。实在找不到方法解决掉`
各位大虾给看一下。。不胜感激。。这个文章问题困扰好久。。
谢谢谢谢谢谢```
<?

$c_page=$_GET['page']; //当前页
$listbyte=5000; //每页显示字节数,
//##寻找文章分页点----------
$contlen=strlen($contstr);
$j=0; //总页数
$listat[0]=0;
$lookAt=0;
for($i=1;$i<$contlen/$listbyte+1;$i++){
if($lookAt<$listbyte)
$lookAt=$listbyte;
echo $lookAt."11<br/>";
if($lookAt>$contlen){
  $j++;
  $listat[$j]=$contlen;
  break;
}
$endAt=strpos($contstr,"\n",$lookAt); // \n
//如果余下的内容不足一页的1/5加到本页或找不到分页符则作一页处理
if($endAt>$contlen-$listbyte/5 or intval($endAt)<1){
  $j++;
  $listat[$j]=$contlen; ///
  break;
}
else{
  $j++;
  $listat[$j]=$endAt;
  $lookAt=$endAt+$listbyte;
}
}
//打印页码
$pagenum=$j;//总页
$page=intval($c_page);
if(empty($page) or $page<1 or $page>$pagenum) $page=1;
if($pagenum>1)
for($i=1;$i<$pagenum+1;$i++){echo "<a href='?page=$i'>$i 页</a>  ";}
//输出当前页内容
$stag=$page-1;
$startb=$listat[$stag];
if($startb>0) //去除首个换行
$startb=$startb+1;
$cont=substr($contstr,$startb,$listat[$page]-$startb);
echo "<BR/>文章内容:<BR/>";
if($page>1)
echo "[接上页]       ";
echo $cont;
?>