echo "$i ";
else
echo "<a href=$self?page=$i>$i</a> ";
}
if($this->openPage < $this->pages) {
echo "<a href=$self?page=$next>Next</a> ";
echo "<a href=$self?page=$last>Last</a> ";
}
else {
echo "Next ";
echo "Last ";
}
}
}
?>
调用示例:
<?php
/***
文件名称
: showresult.php
功
能 : 显示分页结果
***/
include_once("pagination.class.php"); // 调用分页类
$pagination = new pagination();
$query = "SELECT * FROM `student` WHERE 1"; // 查询语句
/*
调用方法,创建分页
@param - 数据库查询
@param -
每页显示的记录数
*/
$pagination->createPaging($query,10);
echo '<table border="1" width="400" align="center">';
while($row=mysql_fetch_object($pagination->resultpage)) {
echo '<tr><td>'.$row->name.'</td><td>'.$row->age.'</td></tr>'; // display name and age from
database
}
echo '</table>';
echo '<table border="1" width="400" align="center">';
echo '<tr><td>';
$pagination->displayPaging();
echo '</td></tr>';
echo '</table>';
?>