Trying to figure out the best way to get and output data
| From: | Seona Bellamy | Date: | Tue, 11 Jan 2005 21:03:07 +0000 |
| Subject: | Trying to figure out the best way to get and output data | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-38109@lists.php.net to get a copy of this message | ||
Hi guys,
I'm relatively new to php, and am pretty much trying to learn as I go along.
I've been struggling to get my head around this problem for a day and half,
so I'm hoping that someone with more familiarity with the language can help
me.
I have the following two tables:
CATEGORY
--------
- ID
- CategoryName
- TitleImage
SECTION
-------
- ID
- CategoryID
- SectionName
- Description
What I want is to get the name of each category and output that, and then
under each category I want to list the sections that belong to it. So for
example:
Catgeory 1
- Section 1
- Section 2
Category 2
- Section 3
- Section 4
Is there a simple way to do this? Do I need to run one query and then run a
second query inside a loop? I have concerns about overheads using this
method, but so far it's the only one I have come up with. I'm open to
suggestions, but please spell everything out clearly because I'm still
learning. :)
Cheers,
Seona.
__________________________________________________________________
<< ella for Spam Control >> has removed Spam messages and set aside Later
for me
You can use it too - and it's FREE! http://www.ellaforspam.com
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.10 - Release Date: 10/01/2005