php中分页显示文章标题

php中文章标题很多的情况下怎样才能分页显示呢?
下面根据本人的体会把主要代码公开,希望对初学网友有所帮助.
$page_size=10;(每页显示数量) $sql=’select count(*) as rnt from
mydbf’; $sql .= ‘ order by mytime desc ‘; $qh=mysql_query($sql);
$data=mysql_fetch_array($qh); $nr=$data[“cnt”];
$pages=intval($nr/$page_size); if($nr%$page_size) $pages ;
if(empty($page)) { $page=1; $offset=0; } else {
$offset=$page*$page_size-$page_size; } ? !– $total =
mysql_numrows($qh); $total=$nr; echo “td colspan=3”; //显示所有文章
if (!isset($page)){ $page = 0; } //分页开始 $start=
$page*澳门新葡亰手机版,$page_size; $offset=$start; $totalpage
=ceil($total/$page_size); $pagestr ='[font
color=green总数/font]:’.$total; $pagestr.= “nbsp”.($page
1).’/’.$totalpage.’页’.”nbsp”; $xjz1= “a href=$php_self?”; $sql =
‘select mytxt,content_id,clicknum,from mydbf ‘; $sql .= ‘ order by
ltime desc limit ‘.$offset.’,’.$pageno; $res =
mysql_query($ls_sql, $dbh); $countloop = 0; while ($row =
mysql_fetch_array($res)) { …. } $xjz1= “a href=$php_self?”;
$xjz2=substr($xjz1,8); ? table border=”0″ width=”100%” cellpadding=”0″
cellspacing=”0″ height=”0″ form action=”?echo
$php_self.$xjz2.”page=$page”;?” method=”post” td width=”100%”
height=”9″ table border=”0″ width=”100%” cellspacing=”0″ cellpadding=”0″
trtd width=”72%” align=”center” nowrapnbsp;b分页/b:?if($page==1){?首页
? } else { $p=$page-1; echo “$xjz1page=1首页/a $xjz1page=$p/a”;