?
$limit = 25;
if (!empty ($start)) $start = 0;
if (!empty ($s)) $s = 0;
mysql_connect ("localhost", "", "");
mysql_select_db (database);
Statistics Database records Total
$result =mysql_query ("SELECT * from table");
$num =mysql_numrows ($result);
$result =mysql_query ("SELECT * from table order by ID limit $start, $limit");
$numb =mysql_numrows ($result);
echo "<table>";
if (!empty ($numb)) {
for ($i =0; $i < $numb; $i + +) {
$val =mysql_result ($result, $i, "Val");
$val 1=mysql_result ($result, $i, "val1");
echo "<tr><td> $val </td><td> $val 1</td></tr>";
}
}
echo "</table>";
The control of digital loop paging
echo "<table>";
echo "<tr><td> page:</td>";
Front Flip Control
if ($s >20) {
if ($s ==21) {
$st = $s-21;
} else {
$st = $s-20;
}
$pstart = $st * $LIMIT;
echo "<td><a href=page.php";
echo "start= $pstart &s= $st >prve</a></td>";
}
echo "<td> >></td>";
Set the current page corresponding pages no link function
$star = $start;
Notice the initial value of the loop, and think about why it's not 0.
for ($page = $s; $page < ($num/$limit); $page + +) {
$start = $page * $LIMIT;
echo "<td>";
if ($page!= $star/$limit) {
echo "<a href=page.php";
echo "start= $start &s= $s >";
}
Echo $page;
if ($page!= $star/$limit) {
echo "</a>";
}
echo "</td>";
Control the digital page limit display, control displays only 20 pages
if ($page >0 && ($page%20) ==0) {
if ($s ==0) {
$s = $s +21;
} else {
$s = $s +20;
}
$start = $start + $limit;
if (($num/$limit)-1) > $page) {
echo "<td> <<</td><td><a href ' page.php?";
echo "start= $start &s= $s >next</a></td>";
}
Notice the control of jumping out of circulation
Break
}
}
echo "</tr></table>";
?>
The above Cheng can complete the powerful circular paging function