First of all thank you for your patient till now.
Please check the following link:
What i want to do, is excactly what you can see at the DIRECTORY section of this site.
I thought it could be easier to code if i use only two level's for categorization.
One main category and one subcategory related only to category via category's id.
Of course if you can post me a query to use unlimited categories and subcategories, i suppose with a use of a parentid into one and only table, it's a lot better.
I have used this method in the past, but i had trouble getting (analyze) the current path when i had a lot subcategories.
For example when i wanted to display :
Script > PHP > Databases > MySQL etc etc...
If there is an easy query to get the full path and another query for the directory display (like the one at
of course i prefer this solution.
I can transform my tables to:
Category (categoryID, categoryDescription, ParentID)
Links (linksid, categoryID, linkdescription etc)
------
To my previous example with the use of only a category and one sub category i'm answering your questions:
are links "related to both category and subcategory" simultaneously? YES
if both fields in a links row have a non-null value, are they consistent? i.e. do you link a link to a subcategory and its parent category too? YES
or is a link related to only a category or a subcategory, but never both? (Always BOTH)
and what do you do if you have a subcategory that wants to have subcategories? do you make it a new category? how do you update the links links when you do that? Subcats can not have other subcats... two level only.
as you can imagine, the answers to these questions will affect how the query is built You are right
also, you said "three (or more) of each subcategory" and this suggests that you do not want categories to be listed if the have fewer than three subcategories No that means i want to list from zero the 3 or more subcategories for each category. For example if a category has only two subcategories i want to display only these two, but if it has ten subcats, i only want to display the CATEGORY.HOWMANYSUBCATEGSTOSHOW (i have added a field like this into categories that represents the number of subcategories the category shows...)
if that's true, do you still want the category listed, with any links that are related to the category? YES
sorry to ask so many questions, but i prefer not to try to write sql until i am comfortble with the data structure
Thanx again for your help and your patient! Hope to find a solution .