首頁
下一页
";尾页
";...
";...
";共" . $this->myde_page_count .
"页" . $this->myde_total . "条数据
?>
include_once("config.php"); $db_pass="";$db_name="test";
require_once('page.class.php'); //分頁類別
$showrow = 3; //一頁顯示的行數
$curpage = empty ($_GET['page']) ? 1 : $_GET['page']; //目前的頁,也應該處理非數字的情況
$url = "?page={page}"; //分頁位址,如果有檢索條件="?page={page}&q=".$_GET['q']
//省略了連結mysql的程式碼,測試時自行加入
$sql = "SELECT id,content,lastdate FROM message";
$total = mysql_num_rows(mysql_query($sql)); //記錄總條數
if (!empty($_GET['page']) && $total != 0 && $curpage > ceil($total / $showrow))
$curpage = ceil($total_rows / $showrow); //目前頁數大於最後頁數,取最後一頁
//取得資料
$sql .= " LIMIT " . ($curpage - 1) * $showrow . ",$showrow;";
$query = mysql_query($sql);
?>
name="description" c />
="text/css">
p{margin:0}
#page{
padding:20px 0px;
}
#page a{
left;
margin-right :10px;
padding:2px 12px;
height:24px; ;
background:#fff;
text-decoration:none font-size:12px;
line -height:24px;
}
#page a:hover{
border:1px #077ee3 solid;
}
#page a.cur{
#page a.cur{
background:#077ee3;
color :#fff;
}
#page p{
2px;
font-size:12px;
height color:#bbb;
border: 1px #ccc solid;
background:#fcfcfc;
margin-right:8px;
}
#page p.pageRemark{
border-style:none;
background:none;
margin-right:0px;
padding:4px 0px;
color:#666;
}
#page p.pageRemark b{
color:red;
}
#page p.pageEllipsis{
border-style:none;
background:none;
padding:4px 0px;
color:#808080;
}
.dates li {font-size: 14px;margin:20px 0}
.dates li span{float:right}
教程:PHP简单漂亮的分页类
echo $page->myde_write();
?>
Powered by sucaihuo.com 本站皆為作者原創,轉載請註明原文連結:www.sucaihuo.com
$host="localhost";$db_user="root";
$timez/Shanghaihai"; =mysql_connect($host,$db_user,$db_pass);
mysql_select_db($db_name,$link);
mysql_query("SET names UTF8");
header("Content-Type: text/html; charset=utf-8 ");
?>
以上就介紹了PHP通用分頁元件,包含了面向的內容,希望對PHP教學有興趣的朋友有幫助。