Well, there's two ways I can think of:

1)  SELECT category FROM table ORDER BY category;
Then cycle through the returned list of categories and assign the category
to $category.  For each category, do:
SELECT * FROM table WHERE category=$category ORDER BY minor_category;

2)  SELECT * FROM table ORDER BY category,minor_category;
Read category from first return; store in $category
Then cycle through returned list.  Whenever the category different from
$category, make your break in the listing and set $category to new category.

-----Original Message-----
From: Shannon Doyle [mailto:[EMAIL PROTECTED]]
Sent: Sunday, December 16, 2001 5:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Query Help


Hi people,

I have a small problem with a select cause that I need to use.

I basically need the following.

Select * from table where page =3D=3D page_name


The fields in the db are

code,description,unit,price,category,minor_category

Then the display needs to be something along the lines of


Category Name

Minor Category
Code Description Unit Price

Minor Category
Code Description Unit Price

Category Name

Minor Category
Code Description Unit Price

The number of minor categories differ for each of the categories, as to
=
do the number of products in each minor_category.

I could hard code in the Category Names, however, they are meant to be =
dynamic as they will be changing on a monthly basis.

Any help would be appreciated.

Thanks

Shannon

_______________________________
Shannon Doyle
Web Design Consultant
BIGBLUE Internet Pty Ltd

149 Hutt St, Adelaide SA 5000
Ph  +61 8 8232 1444
Fax +61 8 8232 8577

http://www.bigblue.net.au


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to