Splitting Product Catalogue Over Multiple Pages?
| From: | Boa Constructor | Date: | Fri, 27 Jun 2003 03:24:46 +0000 |
| Subject: | Splitting Product Catalogue Over Multiple Pages? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-28936@lists.php.net to get a copy of this message | ||
Greetings all, I'm not sure if this has been discussed recently, I've read
bits and pieces and I can't remember where I read everything so if it has
been brought up recently - sorry.
If I do an SQL (MySQL) query on the first example to get the min and max IDs
then I will get 1 and 6 respectively. I will then be able to loop from 1 to
6 and return all 6 products from the database. If however I wanted to split
this in to two pages with 3 items in each page then using the first example
below I could grab the min ID and add 2 to it to make 3. I could not do
this using the second example because if I grab the min ID I would get 3, if
I add 2 to it then I would get 5. 5 does not exit in this table so that
wouldn't work. How in example 2 would I be able to split this over two
pages?
//example 1
ID Product_Name
1 Hoover
2 Kettle
3 Fridge
4 Cooker
5 Food Mixer
6 TV
//example 2
ID Product_Name
3 Fridge
4 Cooker
7 Microwave Oven
8 Freezer
9 DVD Player
10 Computer
Any ideas?
Anything is much appreciated.
Graeme :)