RE: [PHP-DB] Query Help
| From: | Rick Emery | Date: | Mon, 17 Dec 2001 14:04:23 +0000 |
| Subject: | RE: [PHP-DB] Query Help | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-15066@lists.php.net to get a copy of this message | ||
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:shannon@bigblue.net.au]
Sent: Sunday, December 16, 2001 5:05 PM
To: php-db@lists.php.net
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: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net