well, as long as they are related to each other ..

just a quick SQL,



        SELECT
                groupName,
                title
        FROM
                table
        WHERE
                this='is what I need'
        GROUP BY
                groupName
        ORDER BY
                groupName,
                title

this ( I already know I was wrong in this example) will select you the
categories and it's members.

Just try to play with it for a while and you'll arrive to a solution,

with two tables it is still the same.

Just remember : use SQL to do it, not PHP. With PHP there's more job to do
and with it overhead.


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Jordan Elver [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 25, 2001 10:31 PM
To: PHP Database Mailing List; PHP General Mailing List
Subject: [PHP] Retrieving and Printing Categories


Hi,
I've got a load of records that are in different categories.
What is the best way to get all the records or selected records and print
them in such a way that they are grouped (on the page) in their relevent
category, like:

Fruit
-> Apples
-> Pears
-> Bananas

Vegetables
-> Carrots
-> Cabbages

etc, etc.

Sometime my categories are ina dfferent table, don't know if this matters?
How can I do this?

TIA,

Jord

--
PHP General 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