Include ("conn.php");
Fetch URL Value
$pagesize = 10;
$url =$_server["Request_uri"];
$url =parse_url ($url);
$url = $url [path];
$total _row=mysql_num_rows (mysql_query ("SELECT * from Data_test")); Take the total number of bars if ($_get[page]) {
$pagevalue =$_get[page];
$page = ($pagevalue-1) * $pagesize;
$page. =,;
}
$pagenum =ceil ($total _row/$pagesize); Fetch page page echo "<table width=792 height=56 border=0 cellspacing=1>";
echo "<tr bgcolor= #9999FF >";
echo "<th width=33 scope=col>id</th>";
echo "<th width=91 scope=col>trans_type</th>";
echo "<th width=86 scope=col>trans_amt</th>";
echo "<th width=113 scope=col>trans_date</th>";
echo "<th width=68 scope=col>sinage</th>";
echo "<th width=246 scope=col>insert_date</th>";
echo "<th width=109 scope=col>note</th>";
echo "</tr>"; $all _sql = "SELECT * from Data_test limit $page $pagesize"; $query = mysql_query ($all _sql);
while ($row = Mysql_fetch_array ($query)) {
echo "<tr bgcolor= #99FF00 >";
echo "<td> $row [0]</td>";
echo "<td> $row [1]</td>";
echo "<td> $row [2]</td>";
echo "<td> $row [3]</td>";
echo "<td> $row [4]</td>";
echo "<td> $row [5]</td>";
echo "<td> $row [6]</td>";
echo "</tr>";
}echo "</table>";
if ($total _row>= $pagesize) {//Determines whether the total number of records is greater than the number of bars per page
echo "<a href= $url? page=". ($pagevalue =1). " > Home </a> ";
}
for ($i =1; $i <= $pagenum; $i + +) {//Loop page pages
$show = "<a href= $url? page=". ($i). " > $i </a> ";
echo $show. "";
if ($i >= $pagenum) {//Determines whether page pages show end
echo "<a href= $url? page=". ($i-1). " > End </a> ";
}
echo Total. $total _row. Article per page total. $pagesize. Article current section $page. >
PHP Paging Code