RE: pagination

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Newer versions of php user $_POST and $_GET to access form variables...try this

if(!@$_GET['start']) $start = 0;

bastien

From: "Valerie" <valerie1230@xxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Subject:  pagination
Date: Sun, 5 Dec 2004 10:19:03 -0500

It shows next and the first 10 records but will not bring up the next 10
when next is pressed.

<?php
require ('db_params.inc');
if(!$start) $start = 0;
$query2 = 'SELECT count(*) as count '
            . ' FROM `Wellington` '
            . ' WHERE`location`="Hills"';

$result2 = mysql_query($query2);
$row2 = mysql_fetch_array($result2);
$


numrows = $row2['count'];
if($start > 1){
   echo "<a href=\"" . $_SERVER['PHP_SELF']. "?start=" . ($start- 10) .
        "\">Previous</a><BR>";
    }
if($numrows > ($start + 10)){
   echo "<a href=\"" . $_SERVER['PHP_SELF']. "?start=" . ($start + 10) .
       "\">Next</a><BR>";
    }


$query='SELECT * ' . ' FROM `Wellington` ' . ' WHERE`location`="Hills" ORDER BY `LotNo` ASC LIMIT ' . $start. ',10';

            $result=mysql_query($query);
            while ($row = mysql_fetch_assoc($result)) {
        $location=$row['Location'];
        $ln=$row['LotNo'];
        $price=$row['Price'];

         $listing="<html>
         <head>
         </head>
         <body>
             <table align='center'>
              <tr>
            <td>$ln</td>

               <td> $location</td>
               <td>$price</td>
              </tr></table>
              </body></html>";
       echo $listing;
}
?>

----- Original Message -----



-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux