RE: how to implement "pages" of results

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

 



Off the top of my head, doesn't LIMIT accept two paramters?

Can't you do:

LIMIT 30,2

That'd give you page 2 of a 30+ record result set, right?


Using that, you can pass a page # when you click "next page" so previous
page ends up being current page - 1 (and "if that is less than 1, then
it equals 1... And if it's > recordcount / 30 + 1, then it equals
recordcount / 30 + 1)

Try working checking into that.

-TG

> -----Original Message-----
> From: ragan_davis@xxxxxxxxxxxx [mailto:ragan_davis@xxxxxxxxxxxx] 
> Sent: Wednesday, November 24, 2004 3:20 PM
> To: php-db@xxxxxxxxxxxxx
> Subject:  how to implement "pages" of results
> 
> 
> Hi,
> 
> I'm sure this is a common question, so please forgive if it's 
> been posted before.
> 
> I have a select statement that selects records from a table:
> "select * from $table where host='$somename'"
> 
> I then propagate a table with the returned data.  My goal is 
> to only display 30 records per "page", with links on each 
> page that take the user to the next and previous 30 records.  
> I have played around with using "limit", but this seems to 
> only get me the next 30.  How to achieve the previous 30?  It 
> would be easy if the records returned were sequentially 
> numbered...but, since I'm being selective in which records I 
> return (host=$somename), this is not the case.  The first row 
> may be 1, and the second row may be 10, etc.
> 
> Anyone have any ideas on how to solve this?
> 
> Thanks!
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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