Is this possible?
| From: | Tony Crockford | Date: | Wed, 23 Jul 2003 16:32:43 +0000 |
| Subject: | Is this possible? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-156479@lists.php.net to get a copy of this message | ||
Hi
Thanks for the help on previous questions, I now have an in principle
type question.
I have a MySQL database - "items" in one table and "descriptions" in
another with a common key: item_ref
It is used to create a sort of categorised directory of the items.
(http://www.torbytes.co.uk)
each table has a status field the "items" have a default description and
the "descriptions" have a level classification.
up to now been working through all the items and printing out the
descriptions at each level printing the default if I don't have a
matching description, but I now need to do the following:
for a particular level print only the items (and their matching
description) where there is a matching description. (I hope you see what
I mean)
since the items are categorised and I don't want any dead ends in my
tree structure I have to know if there's a description before I start
working through the items.
I thought that this might be the way to do it:
select all the item-ref values from the description table.
step through this select array selecting the required fields from the
item table where item_ref=item_ref and adding them to another array.
then step through that array building up the tree structure
The trouble with it as I see it is:
it's a lot of select calls to the database (one for every description
found) and I'm not sure how to add the fields found in the item table to
a new array.
Am I going at this the wrong way?
Any help, clues or abuse accepted.
Thanks
Tony
--
NEO organizes my Outlook - check it out:
http://www.caelo.com/a/rl.php3?i=3NTVV