Php href/case-switch需要帮助

Php href/case-switch需要帮助,php,paginate,Php,Paginate,我需要找到一种方法让a href从此开始 <a href='{$_SERVER['PHP_SELF']}?currentpage=1'>First</a> "; <?php //Include the PS_Pagination class include('ps_pagination.php'); require_once ('mysql_connect.php'); $q = "SELECT CONCAT(left(First

我需要找到一种方法让a href从此开始

<a href='{$_SERVER['PHP_SELF']}?currentpage=1'>First</a> ";
<?php
    //Include the PS_Pagination class
    include('ps_pagination.php');
    require_once ('mysql_connect.php');

    $q = "SELECT CONCAT(left(FirstName,1),left(MiddleName,1),LastName) AS UserName,
      CONCAT(LastName, ', ', FirstName, ' ', MiddleName) AS Name,
      (NewCustomerID) AS customerid,
      (OldCustomerID) AS oldcustomerid,
      (zlu_birthmonth.Description) AS birthmonth,
      (zlu_cars.Description) AS cartype,
      (zlu_carcolor.Description) AS carcolor,     
      (zlu_computers.Description) AS computer,
      (zlu_race.Description) AS race,
      (zlu_residence.Description) AS residence,
      (IsLaptop) AS IsLaptop,
        CASE IsLaptop
            WHEN '1' THEN 'Yes'
            WHEN '0' THEN 'No'
        END AS laptop

  FROM customer
    INNER JOIN zlu_cars ON(customer.CarID = zlu_cars.CarID)
    INNER JOIN zlu_birthmonth ON(customer.BirthMonthID = zlu_birthmonth.BirthMonthID)
    INNER JOIN zlu_carcolor ON (customer.CarColorID = zlu_carcolor.CarColorID)
    INNER JOIN zlu_computers ON (customer.ComputerID = zlu_computers.ComputerID)
    INNER JOIN zlu_race ON(customer.RaceID = zlu_race.RaceID)
    INNER JOIN zlu_residence ON(customer.ResidenceID = zlu_residence.ResidenceID)
    order by NewCustomerID";


    //Create a PS_Pagination object
    $countperpage = 10;
    $pager = new PS_Pagination($conn,$q,$countperpage,6);

    //The paginate() function returns a mysql result set 
    $rs = $pager->paginate();

    echo '<table  border="1">
              <tr>
                <th>Customer ID</th>
                <th>Old Customer ID</th>
                <th>Customer Name</th>
                <th>UserName</th>
                <th>Car</th>
                <th>Car Color</th>
                <th>Birth Month</th>
                <th>Computer Brand</th>
                <th>Laptop</th>
                <th>Race</th>
                <th>Residence</th>
            </tr>'; 


    while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {

    echo '<tr>
                <td>' . $row['customerid']. '</td>
                <td>' . $row['oldcustomerid']. '</td>
                <td>' . $row['Name'].'</td>
                <td>' . $row['UserName'].'</td>
                <td>' . $row['cartype'].'</td>
                <td>' . $row['carcolor'].'</td>
                <td>' . $row['birthmonth'].'</td>
                <td>' . $row['computer'].'</td>
                <td>' . $row['laptop'].'</td>
                <td>' . $row['race'].'</td>
                <td>' . $row['residence'].'</td>
        </tr>'; } // end of while loop

            echo '</table>';


    //Display the full navigation in one go
    echo "<br><center><font face=verdana size=3 color=blue>";
    echo $pager->renderFullNav();
    echo "</font></center>";

    mysql_free_result($rs);
    mysql_close($conn);



/*  Or you can display the inidividual links...
        echo $pager->renderFirst();         //Display the link to first page: First
        echo $pager->renderPrev();          //Display the link to previous page: <<
        echo $pager->renderNav();           //Display page links: 1 2 3
        echo $pager->renderNext();          //Display the link to next page: >>
        echo $pager->renderLast();          //Display the link to last page: Last
*/

?>
”;
差不多

<a href='index.php?menukey=7... then currentpage=1'>First</a>";
<?php
    //Include the PS_Pagination class
    include('ps_pagination.php');
    require_once ('mysql_connect.php');

    $q = "SELECT CONCAT(left(FirstName,1),left(MiddleName,1),LastName) AS UserName,
      CONCAT(LastName, ', ', FirstName, ' ', MiddleName) AS Name,
      (NewCustomerID) AS customerid,
      (OldCustomerID) AS oldcustomerid,
      (zlu_birthmonth.Description) AS birthmonth,
      (zlu_cars.Description) AS cartype,
      (zlu_carcolor.Description) AS carcolor,     
      (zlu_computers.Description) AS computer,
      (zlu_race.Description) AS race,
      (zlu_residence.Description) AS residence,
      (IsLaptop) AS IsLaptop,
        CASE IsLaptop
            WHEN '1' THEN 'Yes'
            WHEN '0' THEN 'No'
        END AS laptop

  FROM customer
    INNER JOIN zlu_cars ON(customer.CarID = zlu_cars.CarID)
    INNER JOIN zlu_birthmonth ON(customer.BirthMonthID = zlu_birthmonth.BirthMonthID)
    INNER JOIN zlu_carcolor ON (customer.CarColorID = zlu_carcolor.CarColorID)
    INNER JOIN zlu_computers ON (customer.ComputerID = zlu_computers.ComputerID)
    INNER JOIN zlu_race ON(customer.RaceID = zlu_race.RaceID)
    INNER JOIN zlu_residence ON(customer.ResidenceID = zlu_residence.ResidenceID)
    order by NewCustomerID";


    //Create a PS_Pagination object
    $countperpage = 10;
    $pager = new PS_Pagination($conn,$q,$countperpage,6);

    //The paginate() function returns a mysql result set 
    $rs = $pager->paginate();

    echo '<table  border="1">
              <tr>
                <th>Customer ID</th>
                <th>Old Customer ID</th>
                <th>Customer Name</th>
                <th>UserName</th>
                <th>Car</th>
                <th>Car Color</th>
                <th>Birth Month</th>
                <th>Computer Brand</th>
                <th>Laptop</th>
                <th>Race</th>
                <th>Residence</th>
            </tr>'; 


    while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {

    echo '<tr>
                <td>' . $row['customerid']. '</td>
                <td>' . $row['oldcustomerid']. '</td>
                <td>' . $row['Name'].'</td>
                <td>' . $row['UserName'].'</td>
                <td>' . $row['cartype'].'</td>
                <td>' . $row['carcolor'].'</td>
                <td>' . $row['birthmonth'].'</td>
                <td>' . $row['computer'].'</td>
                <td>' . $row['laptop'].'</td>
                <td>' . $row['race'].'</td>
                <td>' . $row['residence'].'</td>
        </tr>'; } // end of while loop

            echo '</table>';


    //Display the full navigation in one go
    echo "<br><center><font face=verdana size=3 color=blue>";
    echo $pager->renderFullNav();
    echo "</font></center>";

    mysql_free_result($rs);
    mysql_close($conn);



/*  Or you can display the inidividual links...
        echo $pager->renderFirst();         //Display the link to first page: First
        echo $pager->renderPrev();          //Display the link to previous page: <<
        echo $pager->renderNav();           //Display page links: 1 2 3
        echo $pager->renderNext();          //Display the link to next page: >>
        echo $pager->renderLast();          //Display the link to last page: Last
*/

?>
”;
我需要一个分页的页面,以打开一个开关盒区域。以下代码是分页页面的代码。任何帮助都将不胜感激

<?php
    //Include the PS_Pagination class
    include('ps_pagination.php');
    require_once ('mysql_connect.php');

    $q = "SELECT CONCAT(left(FirstName,1),left(MiddleName,1),LastName) AS UserName,
      CONCAT(LastName, ', ', FirstName, ' ', MiddleName) AS Name,
      (NewCustomerID) AS customerid,
      (OldCustomerID) AS oldcustomerid,
      (zlu_birthmonth.Description) AS birthmonth,
      (zlu_cars.Description) AS cartype,
      (zlu_carcolor.Description) AS carcolor,     
      (zlu_computers.Description) AS computer,
      (zlu_race.Description) AS race,
      (zlu_residence.Description) AS residence,
      (IsLaptop) AS IsLaptop,
        CASE IsLaptop
            WHEN '1' THEN 'Yes'
            WHEN '0' THEN 'No'
        END AS laptop

  FROM customer
    INNER JOIN zlu_cars ON(customer.CarID = zlu_cars.CarID)
    INNER JOIN zlu_birthmonth ON(customer.BirthMonthID = zlu_birthmonth.BirthMonthID)
    INNER JOIN zlu_carcolor ON (customer.CarColorID = zlu_carcolor.CarColorID)
    INNER JOIN zlu_computers ON (customer.ComputerID = zlu_computers.ComputerID)
    INNER JOIN zlu_race ON(customer.RaceID = zlu_race.RaceID)
    INNER JOIN zlu_residence ON(customer.ResidenceID = zlu_residence.ResidenceID)
    order by NewCustomerID";


    //Create a PS_Pagination object
    $countperpage = 10;
    $pager = new PS_Pagination($conn,$q,$countperpage,6);

    //The paginate() function returns a mysql result set 
    $rs = $pager->paginate();

    echo '<table  border="1">
              <tr>
                <th>Customer ID</th>
                <th>Old Customer ID</th>
                <th>Customer Name</th>
                <th>UserName</th>
                <th>Car</th>
                <th>Car Color</th>
                <th>Birth Month</th>
                <th>Computer Brand</th>
                <th>Laptop</th>
                <th>Race</th>
                <th>Residence</th>
            </tr>'; 


    while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {

    echo '<tr>
                <td>' . $row['customerid']. '</td>
                <td>' . $row['oldcustomerid']. '</td>
                <td>' . $row['Name'].'</td>
                <td>' . $row['UserName'].'</td>
                <td>' . $row['cartype'].'</td>
                <td>' . $row['carcolor'].'</td>
                <td>' . $row['birthmonth'].'</td>
                <td>' . $row['computer'].'</td>
                <td>' . $row['laptop'].'</td>
                <td>' . $row['race'].'</td>
                <td>' . $row['residence'].'</td>
        </tr>'; } // end of while loop

            echo '</table>';


    //Display the full navigation in one go
    echo "<br><center><font face=verdana size=3 color=blue>";
    echo $pager->renderFullNav();
    echo "</font></center>";

    mysql_free_result($rs);
    mysql_close($conn);



/*  Or you can display the inidividual links...
        echo $pager->renderFirst();         //Display the link to first page: First
        echo $pager->renderPrev();          //Display the link to previous page: <<
        echo $pager->renderNav();           //Display page links: 1 2 3
        echo $pager->renderNext();          //Display the link to next page: >>
        echo $pager->renderLast();          //Display the link to last page: Last
*/

?>
多谢各位

<?php
require_once ('mysqli_connect.php');
$sql = "SELECT COUNT(NewCustomerID) FROM customer";
$result = @mysqli_query($dbc, $sql);
$r = @mysqli_fetch_row($result);
$numrows = $r[0];

$rowsperpage = 10; 

    // find out total pages
    $totalpages = ceil($numrows / $rowsperpage);

    // get the current page or set a default
    if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
       // cast var as int
       $currentpage = (int) $_GET['currentpage'];
    } else {
       // default page num
       $currentpage = 1;
    } // end if


    // if current page is greater than total pages...
    if ($currentpage > $totalpages) {
       // set current page to last page
       $currentpage = $totalpages;
    } // end if

    // if current page is less than first page...
    if ($currentpage < 1) {
       // set current page to first page
       $currentpage = 1;
    } // end if

    // the offset of the list, based on current page 
    $offset = ($currentpage - 1) * $rowsperpage;


    $q = "SELECT CONCAT(left(FirstName,1),left(MiddleName,1),LastName) AS UserName,
      CONCAT(LastName, ', ', FirstName, ' ', MiddleName) AS Name,
      (NewCustomerID) AS customerid,
      (OldCustomerID) AS oldcustomerid,
      (zlu_birthmonth.Description) AS birthmonth,
      (zlu_cars.Description) AS cartype,
      (zlu_carcolor.Description) AS carcolor,     
      (zlu_computers.Description) AS computer,
      (zlu_race.Description) AS race,
      (zlu_residence.Description) AS residence,
      (IsLaptop) AS IsLaptop,
        CASE IsLaptop
            WHEN '1' THEN 'Yes'
            WHEN '0' THEN 'No'
        END AS laptop

  FROM customer
    INNER JOIN zlu_cars ON(customer.CarID = zlu_cars.CarID)
    INNER JOIN zlu_birthmonth ON(customer.BirthMonthID = zlu_birthmonth.BirthMonthID)
    INNER JOIN zlu_carcolor ON (customer.CarColorID = zlu_carcolor.CarColorID)
    INNER JOIN zlu_computers ON (customer.ComputerID = zlu_computers.ComputerID)
    INNER JOIN zlu_race ON(customer.RaceID = zlu_race.RaceID)
    INNER JOIN zlu_residence ON(customer.ResidenceID = zlu_residence.ResidenceID)
    order by NewCustomerID LIMIT $offset, $rowsperpage";

$result  = @mysqli_query($dbc, $q); if(!$result ){die(mysqli_error($dbc));} 


    echo '<table  border="1">
              <tr>
                <th>Customer ID</th>
                <th>Old Customer ID</th>
                <th>Customer Name</th>
                <th>UserName</th>
                <th>Car</th>
                <th>Car Color</th>
                <th>Birth Month</th>
                <th>Computer Brand</th>
                <th>Laptop</th>
                <th>Race</th>
                <th>Residence</th>
            </tr>'; 

    $bg = '#eeeeee'; // set initial back ground color

    while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
        $bg = ($bg =='#eeeeee' ? '#ffffff' : '#eeeeee'); // switch the background color.

    echo '<tr bgcolor="' . $bg . '">
                <td>' . $row['customerid']. '</td>
                <td>' . $row['oldcustomerid']. '</td>
                <td>' . $row['Name'].'</td>
                <td>' . $row['UserName'].'</td>
                <td>' . $row['cartype'].'</td>
                <td>' . $row['carcolor'].'</td>
                <td>' . $row['birthmonth'].'</td>
                <td>' . $row['computer'].'</td>
                <td>' . $row['laptop'].'</td>
                <td>' . $row['race'].'</td>
                <td>' . $row['residence'].'</td>
        </tr>'; } // end of while loop

echo '</table>';


?>
<?php

/******  build the pagination links ******/
// range of num links to show
$range = 3;
if($currentpage==1)
{
    echo '<span class="prn">  First &lt;&lt;</span>&nbsp;';
} 
if ($currentpage > 1) {
   // show << link to go back to page 1

   echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'>First</a> ";
   // get previous page num
   $prevpage = $currentpage - 1;
   // show < link to go back to 1 page

   echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'> < </a> ";
} // end if 

// loop to show links to range of pages around current page
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
   // if it's a valid page number...
   if (($x > 0) && ($x <= $totalpages)) {
      // if we're on current page...
      if ($x == $currentpage) {
         // 'highlight' it but don't make a link
         echo " <b>$x</b> ";
      // if not current page...
      } else {
         // make it a link
         echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> ";
      } // end else
   } // end if 
} // end for

// if not on last page, show forward and last page links        
if ($currentpage != $totalpages) {
   // get next page
   $nextpage = $currentpage + 1;
    // echo forward link for next page 
   echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'> > </a> ";
   // echo forward link for lastpage
   echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>Last</a> ";
} // end if
else
{
    echo '<span class="prn"> Last &gt;&gt;</span>&nbsp;';
}
/****** end build pagination links ******/
mysqli_close($dbc);
?>
<?php
    //Include the PS_Pagination class
    include('ps_pagination.php');
    require_once ('mysql_connect.php');

    $q = "SELECT CONCAT(left(FirstName,1),left(MiddleName,1),LastName) AS UserName,
      CONCAT(LastName, ', ', FirstName, ' ', MiddleName) AS Name,
      (NewCustomerID) AS customerid,
      (OldCustomerID) AS oldcustomerid,
      (zlu_birthmonth.Description) AS birthmonth,
      (zlu_cars.Description) AS cartype,
      (zlu_carcolor.Description) AS carcolor,     
      (zlu_computers.Description) AS computer,
      (zlu_race.Description) AS race,
      (zlu_residence.Description) AS residence,
      (IsLaptop) AS IsLaptop,
        CASE IsLaptop
            WHEN '1' THEN 'Yes'
            WHEN '0' THEN 'No'
        END AS laptop

  FROM customer
    INNER JOIN zlu_cars ON(customer.CarID = zlu_cars.CarID)
    INNER JOIN zlu_birthmonth ON(customer.BirthMonthID = zlu_birthmonth.BirthMonthID)
    INNER JOIN zlu_carcolor ON (customer.CarColorID = zlu_carcolor.CarColorID)
    INNER JOIN zlu_computers ON (customer.ComputerID = zlu_computers.ComputerID)
    INNER JOIN zlu_race ON(customer.RaceID = zlu_race.RaceID)
    INNER JOIN zlu_residence ON(customer.ResidenceID = zlu_residence.ResidenceID)
    order by NewCustomerID";


    //Create a PS_Pagination object
    $countperpage = 10;
    $pager = new PS_Pagination($conn,$q,$countperpage,6);

    //The paginate() function returns a mysql result set 
    $rs = $pager->paginate();

    echo '<table  border="1">
              <tr>
                <th>Customer ID</th>
                <th>Old Customer ID</th>
                <th>Customer Name</th>
                <th>UserName</th>
                <th>Car</th>
                <th>Car Color</th>
                <th>Birth Month</th>
                <th>Computer Brand</th>
                <th>Laptop</th>
                <th>Race</th>
                <th>Residence</th>
            </tr>'; 


    while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {

    echo '<tr>
                <td>' . $row['customerid']. '</td>
                <td>' . $row['oldcustomerid']. '</td>
                <td>' . $row['Name'].'</td>
                <td>' . $row['UserName'].'</td>
                <td>' . $row['cartype'].'</td>
                <td>' . $row['carcolor'].'</td>
                <td>' . $row['birthmonth'].'</td>
                <td>' . $row['computer'].'</td>
                <td>' . $row['laptop'].'</td>
                <td>' . $row['race'].'</td>
                <td>' . $row['residence'].'</td>
        </tr>'; } // end of while loop

            echo '</table>';


    //Display the full navigation in one go
    echo "<br><center><font face=verdana size=3 color=blue>";
    echo $pager->renderFullNav();
    echo "</font></center>";

    mysql_free_result($rs);
    mysql_close($conn);



/*  Or you can display the inidividual links...
        echo $pager->renderFirst();         //Display the link to first page: First
        echo $pager->renderPrev();          //Display the link to previous page: <<
        echo $pager->renderNav();           //Display page links: 1 2 3
        echo $pager->renderNext();          //Display the link to next page: >>
        echo $pager->renderLast();          //Display the link to last page: Last
*/

?>
试试这个:

<?php
$url = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
echo $url;
<?php
    //Include the PS_Pagination class
    include('ps_pagination.php');
    require_once ('mysql_connect.php');

    $q = "SELECT CONCAT(left(FirstName,1),left(MiddleName,1),LastName) AS UserName,
      CONCAT(LastName, ', ', FirstName, ' ', MiddleName) AS Name,
      (NewCustomerID) AS customerid,
      (OldCustomerID) AS oldcustomerid,
      (zlu_birthmonth.Description) AS birthmonth,
      (zlu_cars.Description) AS cartype,
      (zlu_carcolor.Description) AS carcolor,     
      (zlu_computers.Description) AS computer,
      (zlu_race.Description) AS race,
      (zlu_residence.Description) AS residence,
      (IsLaptop) AS IsLaptop,
        CASE IsLaptop
            WHEN '1' THEN 'Yes'
            WHEN '0' THEN 'No'
        END AS laptop

  FROM customer
    INNER JOIN zlu_cars ON(customer.CarID = zlu_cars.CarID)
    INNER JOIN zlu_birthmonth ON(customer.BirthMonthID = zlu_birthmonth.BirthMonthID)
    INNER JOIN zlu_carcolor ON (customer.CarColorID = zlu_carcolor.CarColorID)
    INNER JOIN zlu_computers ON (customer.ComputerID = zlu_computers.ComputerID)
    INNER JOIN zlu_race ON(customer.RaceID = zlu_race.RaceID)
    INNER JOIN zlu_residence ON(customer.ResidenceID = zlu_residence.ResidenceID)
    order by NewCustomerID";


    //Create a PS_Pagination object
    $countperpage = 10;
    $pager = new PS_Pagination($conn,$q,$countperpage,6);

    //The paginate() function returns a mysql result set 
    $rs = $pager->paginate();

    echo '<table  border="1">
              <tr>
                <th>Customer ID</th>
                <th>Old Customer ID</th>
                <th>Customer Name</th>
                <th>UserName</th>
                <th>Car</th>
                <th>Car Color</th>
                <th>Birth Month</th>
                <th>Computer Brand</th>
                <th>Laptop</th>
                <th>Race</th>
                <th>Residence</th>
            </tr>'; 


    while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {

    echo '<tr>
                <td>' . $row['customerid']. '</td>
                <td>' . $row['oldcustomerid']. '</td>
                <td>' . $row['Name'].'</td>
                <td>' . $row['UserName'].'</td>
                <td>' . $row['cartype'].'</td>
                <td>' . $row['carcolor'].'</td>
                <td>' . $row['birthmonth'].'</td>
                <td>' . $row['computer'].'</td>
                <td>' . $row['laptop'].'</td>
                <td>' . $row['race'].'</td>
                <td>' . $row['residence'].'</td>
        </tr>'; } // end of while loop

            echo '</table>';


    //Display the full navigation in one go
    echo "<br><center><font face=verdana size=3 color=blue>";
    echo $pager->renderFullNav();
    echo "</font></center>";

    mysql_free_result($rs);
    mysql_close($conn);



/*  Or you can display the inidividual links...
        echo $pager->renderFirst();         //Display the link to first page: First
        echo $pager->renderPrev();          //Display the link to previous page: <<
        echo $pager->renderNav();           //Display page links: 1 2 3
        echo $pager->renderNext();          //Display the link to next page: >>
        echo $pager->renderLast();          //Display the link to last page: Last
*/

?>
页面代码

<?php
    //Include the PS_Pagination class
    include('ps_pagination.php');
    require_once ('mysql_connect.php');

    $q = "SELECT CONCAT(left(FirstName,1),left(MiddleName,1),LastName) AS UserName,
      CONCAT(LastName, ', ', FirstName, ' ', MiddleName) AS Name,
      (NewCustomerID) AS customerid,
      (OldCustomerID) AS oldcustomerid,
      (zlu_birthmonth.Description) AS birthmonth,
      (zlu_cars.Description) AS cartype,
      (zlu_carcolor.Description) AS carcolor,     
      (zlu_computers.Description) AS computer,
      (zlu_race.Description) AS race,
      (zlu_residence.Description) AS residence,
      (IsLaptop) AS IsLaptop,
        CASE IsLaptop
            WHEN '1' THEN 'Yes'
            WHEN '0' THEN 'No'
        END AS laptop

  FROM customer
    INNER JOIN zlu_cars ON(customer.CarID = zlu_cars.CarID)
    INNER JOIN zlu_birthmonth ON(customer.BirthMonthID = zlu_birthmonth.BirthMonthID)
    INNER JOIN zlu_carcolor ON (customer.CarColorID = zlu_carcolor.CarColorID)
    INNER JOIN zlu_computers ON (customer.ComputerID = zlu_computers.ComputerID)
    INNER JOIN zlu_race ON(customer.RaceID = zlu_race.RaceID)
    INNER JOIN zlu_residence ON(customer.ResidenceID = zlu_residence.ResidenceID)
    order by NewCustomerID";


    //Create a PS_Pagination object
    $countperpage = 10;
    $pager = new PS_Pagination($conn,$q,$countperpage,6);

    //The paginate() function returns a mysql result set 
    $rs = $pager->paginate();

    echo '<table  border="1">
              <tr>
                <th>Customer ID</th>
                <th>Old Customer ID</th>
                <th>Customer Name</th>
                <th>UserName</th>
                <th>Car</th>
                <th>Car Color</th>
                <th>Birth Month</th>
                <th>Computer Brand</th>
                <th>Laptop</th>
                <th>Race</th>
                <th>Residence</th>
            </tr>'; 


    while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {

    echo '<tr>
                <td>' . $row['customerid']. '</td>
                <td>' . $row['oldcustomerid']. '</td>
                <td>' . $row['Name'].'</td>
                <td>' . $row['UserName'].'</td>
                <td>' . $row['cartype'].'</td>
                <td>' . $row['carcolor'].'</td>
                <td>' . $row['birthmonth'].'</td>
                <td>' . $row['computer'].'</td>
                <td>' . $row['laptop'].'</td>
                <td>' . $row['race'].'</td>
                <td>' . $row['residence'].'</td>
        </tr>'; } // end of while loop

            echo '</table>';


    //Display the full navigation in one go
    echo "<br><center><font face=verdana size=3 color=blue>";
    echo $pager->renderFullNav();
    echo "</font></center>";

    mysql_free_result($rs);
    mysql_close($conn);



/*  Or you can display the inidividual links...
        echo $pager->renderFirst();         //Display the link to first page: First
        echo $pager->renderPrev();          //Display the link to previous page: <<
        echo $pager->renderNav();           //Display page links: 1 2 3
        echo $pager->renderNext();          //Display the link to next page: >>
        echo $pager->renderLast();          //Display the link to last page: Last
*/

?>
IT-5334:PHP和MySQL -->

<?php
    //Include the PS_Pagination class
    include('ps_pagination.php');
    require_once ('mysql_connect.php');

    $q = "SELECT CONCAT(left(FirstName,1),left(MiddleName,1),LastName) AS UserName,
      CONCAT(LastName, ', ', FirstName, ' ', MiddleName) AS Name,
      (NewCustomerID) AS customerid,
      (OldCustomerID) AS oldcustomerid,
      (zlu_birthmonth.Description) AS birthmonth,
      (zlu_cars.Description) AS cartype,
      (zlu_carcolor.Description) AS carcolor,     
      (zlu_computers.Description) AS computer,
      (zlu_race.Description) AS race,
      (zlu_residence.Description) AS residence,
      (IsLaptop) AS IsLaptop,
        CASE IsLaptop
            WHEN '1' THEN 'Yes'
            WHEN '0' THEN 'No'
        END AS laptop

  FROM customer
    INNER JOIN zlu_cars ON(customer.CarID = zlu_cars.CarID)
    INNER JOIN zlu_birthmonth ON(customer.BirthMonthID = zlu_birthmonth.BirthMonthID)
    INNER JOIN zlu_carcolor ON (customer.CarColorID = zlu_carcolor.CarColorID)
    INNER JOIN zlu_computers ON (customer.ComputerID = zlu_computers.ComputerID)
    INNER JOIN zlu_race ON(customer.RaceID = zlu_race.RaceID)
    INNER JOIN zlu_residence ON(customer.ResidenceID = zlu_residence.ResidenceID)
    order by NewCustomerID";


    //Create a PS_Pagination object
    $countperpage = 10;
    $pager = new PS_Pagination($conn,$q,$countperpage,6);

    //The paginate() function returns a mysql result set 
    $rs = $pager->paginate();

    echo '<table  border="1">
              <tr>
                <th>Customer ID</th>
                <th>Old Customer ID</th>
                <th>Customer Name</th>
                <th>UserName</th>
                <th>Car</th>
                <th>Car Color</th>
                <th>Birth Month</th>
                <th>Computer Brand</th>
                <th>Laptop</th>
                <th>Race</th>
                <th>Residence</th>
            </tr>'; 


    while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {

    echo '<tr>
                <td>' . $row['customerid']. '</td>
                <td>' . $row['oldcustomerid']. '</td>
                <td>' . $row['Name'].'</td>
                <td>' . $row['UserName'].'</td>
                <td>' . $row['cartype'].'</td>
                <td>' . $row['carcolor'].'</td>
                <td>' . $row['birthmonth'].'</td>
                <td>' . $row['computer'].'</td>
                <td>' . $row['laptop'].'</td>
                <td>' . $row['race'].'</td>
                <td>' . $row['residence'].'</td>
        </tr>'; } // end of while loop

            echo '</table>';


    //Display the full navigation in one go
    echo "<br><center><font face=verdana size=3 color=blue>";
    echo $pager->renderFullNav();
    echo "</font></center>";

    mysql_free_result($rs);
    mysql_close($conn);



/*  Or you can display the inidividual links...
        echo $pager->renderFirst();         //Display the link to first page: First
        echo $pager->renderPrev();          //Display the link to previous page: <<
        echo $pager->renderNav();           //Display page links: 1 2 3
        echo $pager->renderNext();          //Display the link to next page: >>
        echo $pager->renderLast();          //Display the link to last page: Last
*/

?>

您的问题不是很清楚,您的意思是如何向链接附加另一个值?比如
index.php?currentpage=1&menukey=7
或者您需要帮助才能首先获得menukey吗?不,Ricardo,将index.php?menukey=7添加到链接中。我想还是不太清楚,您想用
index.php?menukey=7¤tpage=1
替换
{$\u SERVER['php_SELF]}currentpage=1
吗?是的,但是如果我像那样做,其他页面就不会打开,我怎么能在菜单中打开呢?bpe?