PHP simple paging, PHP paging _php tutorial

Source: Internet
Author: User

PHP simple paging, PHP paging






Untitled Document


$conn =mysql_connect ("localhost", "root", "123");
mysql_select_db ("QQ", $conn);
mysql_query ("Set names UTF8");
$length = 5;
$pagenum =isset ($_get[' page ')? $_get[' page ']:1;
$totsql = "SELECT count (*) from Q1";
$totarr =mysql_fetch_row (mysql_query ($totsql));
$pagetot =ceil ($totarr [0]/$length);
if ($pagenum >= $pagetot) {
$pagenum = $pagetot;
}
$offset = ($pagenum-1) * $LENGTH;
$sql = "SELECT * from Q1 the ORDER by ID limit {$offset},{$length}";
$ret =mysql_query ($sql);
echo "

";
echo "







"While ($row =mysql_fetch_assoc ($ret)) {echo" "; Echo" "; Echo" "; Echo" "; Echo" ";} echo "
{$row [' id ']}{$row [' name ']}{$row [' Pass ']}
";
$prevpage = $pagenum-1;
$nextpage = $pagenum +1;
echo "

Up | down

";
echo " ";
Mysql_close ($conn);

?>

http://www.bkjia.com/PHPjc/1091268.html www.bkjia.com true http://www.bkjia.com/PHPjc/1091268.html techarticle php Simple paging, PHP page! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "HTML xmlns=" HTTP://WWW.W3.ORG/1 ...

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