PHP Paging Query

Source: Internet
Author: User

<?phpinclude "page.class.php"; include "db.class.php"; $db = new db (); $name = ""; $tj = ""; if (!empty ($_post["MC"])// Determine if the query text box has a value {$name = $_post["MC"]; $tj = "n={$name}";//*** paging Condition}if (!empty ($_get["n"]))//based on POST values {$name = $_get["n"];$ TJ = "name={$name}";} $w = "where areaname like '%{$name}% '";//Condition query? ><br/><form action= "fenye.php" method= "POST" > <!--Build Query Button--><div> Please enter name: <input type= "text" Name= "MC" value= "<?php echo $name?>"/>  <input type= " Submit "value=" Query "/></div></form><br/><table width=" 100% "border=" 1 "cellpadding=" 0 " cellspacing= "0" > <tr><td> code </td><td> name </td><td> Parent code &LT;/TD&GT;&LT;/TR &GT;&LT;?PHP$SQL1 = "SELECT count (*) from chinastates". $w;//Total Data $attr = $db->query ($sql 1); $total = $attr [0][0]; $page = new Page ($total, $TJ, true);//1, total data 2, data volume per page 3, paging condition 4,true display first page, false display last $SQL2 = "SELECT * from Chinastates". $w $pa ge->limit;//Conditional Paging query = $db->query($sql 2), foreach ($r as $v) {echo "<tr><td>{$v [0]}</td><td>{$v [1]}</td><td>{$v [2 ]}</td></tr> ";}? &GT;&LT;/TABLE&GT;&LT;BR/><?phpecho $page->fpage ();//Paging Query menu?>

  

PHP Paging Query

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.