Re: [PHP] Best way to handle PREVIOUS and NEXT processing of database records retrieved

2006-01-26 Thread Richard Lynch
On Thu, January 26, 2006 2:27 pm, Sue wrote:
> I am retrieving records from a MySQL database and need to just display
> each
> record one after the other on a page.  I only want to display a
> maximum of
> 25 records per page though, and am wondering if there is a way to
> handle
> this easily within PHP?  I'd like to use something like NEXT and
> PREVIOUS as
> links to go back and forth from each of the pages if there is more
> than 1
> page of data to display.  Any examples/ideas would be greatly
> appreciated.

There are probably a few thousand PHP / MySQL "pagination" classes out
there...

http://info.com/php+mysql+pagination

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] Best way to handle PREVIOUS and NEXT processing of database records retrieved

2006-01-26 Thread Weber Sites LTD
Check out : 

Pagination
http://www.weberdev.com/get_example-4242.html 

Sincerely 
 
berber 
 
Visit the Weber Sites Today, 
To see where PHP might take you tomorrow. 
PHP code examples : http://www.weberdev.com 
Free Uptime Monitor : http://uptime.weberdev.com
PHP content for your site : http://content.weber-sites.com


-Original Message-
From: Sue [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 26, 2006 10:27 PM
To: php-general@lists.php.net
Subject: [PHP] Best way to handle PREVIOUS and NEXT processing of database
records retrieved

I am retrieving records from a MySQL database and need to just display each
record one after the other on a page.  I only want to display a maximum of
25 records per page though, and am wondering if there is a way to handle
this easily within PHP?  I'd like to use something like NEXT and PREVIOUS as
links to go back and forth from each of the pages if there is more than 1
page of data to display.  Any examples/ideas would be greatly appreciated.

Thanks in advance! 

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

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



Re: [PHP] Best way to handle PREVIOUS and NEXT processing of database records retrieved

2006-01-26 Thread Jay Paulson
You could always use the LIMIT functionality in MySQL

SELECT * FROM table LIMIT 0,25

Then just pass the variables for the limit to start at and how many you want
returned in your query.

SELECT * FROM table LIMIT $start,$num_returned

So looking at records 26 through 50 your links would look like below.

Next |
Previous

Just make sure you check your variables so they are numbers to avoid any
kind of SQL injection.


On 1/26/06 2:27 PM, "Sue" <[EMAIL PROTECTED]> wrote:

> I am retrieving records from a MySQL database and need to just display each
> record one after the other on a page.  I only want to display a maximum of
> 25 records per page though, and am wondering if there is a way to handle
> this easily within PHP?  I'd like to use something like NEXT and PREVIOUS as
> links to go back and forth from each of the pages if there is more than 1
> page of data to display.  Any examples/ideas would be greatly appreciated.
> 
> Thanks in advance! 

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