_php Tutorial to achieve page-turn jump function

Source: Internet
Author: User
$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 " "; } } echo "
$val $val 1
";

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 " "; "; } echo " "; "; "; } Notice the control break that jumps out of the loop; }} echo "
Page:echo "start= $pstart &s= $st >prve>>";

if ($page! = $star/$limit) {
echo "echo" start= $start &s= $s > ";
}

Echo $page;

if ($page! = $star/$limit) {
echo "";
}

echo "

<< echo "start= $start &s= $s >next
";
?>

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 ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.