Re: Previous Next problems !!
| From: | Steve Werby | Date: | Thu, 08 Feb 2001 15:10:36 +0000 |
| Subject: | Re: Previous Next problems !! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-38760@lists.php.net to get a copy of this message | ||
"Niel Zeeman" <NZeeman@BTech.co.za> wrote:
> I'm looking for a way to have a "next 10 records" "previous 10
> records"
type
> of sinario, extracting records from a database. Now the only problem is
that
> I want to do it in Interbase. I know mysql has a seek option and a method
> of only returning a segment of records but I'm having no luck in
interbase..
I've never touched Interbase, but here's how I do it in MySQL in general
terms.
1. Get result set.
2. Count number of records in result.
3. Set records per page ( $records_per_page ).
4. Pass page number in query string ( $SCRIPT_URL?page=$page ).
5. Build hyperlinks for previous, next from variables from 2, 3 and 4.
Handle special case of previous or next not being valid based on first or
last page cases.
6. Use SELECT my_fields FROM my_table WHERE where_clause LIMIT $row_start,
$records_per_page to generate records for the web page.
Hopefully it will make sense once you start playing with it.
--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/