$limit = 25;
if (!empty ($start)) $start = 0;
if (!empty ($s)) $s = 0;
mysql_connect ("localhost", "", "");
mysql_select_db (database);
Total Statistics Database records
$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 "
"; if (!empty ($numb)) {for ($i =0; $i < $numb; $i + +) {$val =mysql_result ($result, $i, "Val"), $val 1=mysql_result ($result, $i , "Val1"); echo "
$val |
$val 1 |
"; } } echo "
";
Control of Digital Cycle paging
echo "
Front Turn control
if ($s >20) {
if ($s ==21) {
$st = $s-21;
} else {
$st = $s-20;
}
$pstart = $st * $LIMIT;
echo "
To set the number of pages in the current page no link function
$star = $start;
Pay attention to 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 "
Control the digital page limit display function, control only display 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 "
"; echo "
Page: | ";
echo "start= $pstart &s= $st >prve | "; } echo "
>> | ";
"; if ($page! = $star/$limit) { echo "echo" start= $start &s= $s > "; } Echo $page; if ($page! = $star/$limit) { echo ""; } echo " | ";
<< |
echo "start= $start &s= $s >next | "; } Notice the control break that jumps out of the loop; }} echo "
";
?>
The above Cheng can complete the powerful circular paging function
http://www.bkjia.com/PHPjc/631946.html www.bkjia.com true http://www.bkjia.com/PHPjc/631946.html techarticle $limit =25; if (!empty ($start)) $start =0, if (!empty ($s)) $s =0; mysql_connect (localhost,,); mysql_select_db ( database); Total statistics Database records $result =mysql_query (SELECT * F ...