Wow, intense post!! (You seem to have answers for everything?!)
So, I read what you had to say, and "Yes", it sure seems that you were able to get things to work, however I have to take a long hard look at what you did and *digest* all of this?!
Here are two big areas where I have questions on your latest post...
1.) I was somewhat unfamiliar with your SQL. I tend to be anal-retentive, and always use INNER JOINs.
This is how I would code things...
SELECT sd.section, sd.dimemsion, ss.subsection, ss.article
FROM section_dimension AS sd
INNER JOIN dimension_subsection AS ds
ON sd.dimension = ds.dimension
INNER JOIN subsection AS ss
ON ds.subsection = ss.subsection
Would that also work?
(Yes, I'll test it out. But you'll likely respond before I can.)
Can you explain the difference between our SQL?
2.) I feel kind of dumb right now, but for some unknown reason, I thought that I had to *physically* link together SECTION_DIMENSION and DIMENSION_SUBSECTION in order for things to work?!
I guess when I look at the ERD I drew out, I technically do have all of my Tables from "Section" through "Article" daisy-chained together. (Just not in a way I am used to?!)
So that is why I was freaking out, thinking that I would need to create more tables like SECTION_DIMENSION_SUBSECTION and SECTION_DIMENSION_SUBSECTION_ARTICLE.
See my (wrong) thinking?
Originally Posted by Old Pedant
Okay, bear with me. I'm going to try to see where you are seeing the problem(s).
I created some tables:
mysql> select * from section_dimension;
| section | dimension |
| Finance | Offering |
| Legal | Offering |
| Legal | Featured_Legal |
3 rows in set (0.00 sec)
How do you get those nifty Text Tables? (I hope you aren't typing those out by hand?!)
They sure made your response 100 times easier to follow!!
And now what happens if the URLs are (examples)
I will presume that you are going to use rewrite rules to convert those urls into
Yes, a big part of all of this is that I am using "Pretty URLs", and so I use mod_rewrites to transform a user-friendly URL for the user into something my PHP can use to find the Article.
And, indeed, for the first three URLs given there, I will get one article each.
For the last URL, with the invalid combination of section and subsection, I get the "no articles" message.
Where is the problem in all of that?
Am I just being way too simplistic????
I think you may have nailed it, but my tiny 486-processor of a brain needs time to process all of this.
Answering my latest two questions above, will definitely close-the-gap, though!!
In the mean time, I am going to try and reproduce your example above in my actual database. (This is sort of a pain, since I already laid out more realistic tables in MySQL. Either I create simple test tables like you used, or I may be bold and see if I can recreate a similar result with my actual table structure and data?!)
You've been an enormous help so far, and I appreciate your patience with me. (It's always easier to learn when people aren't putting you down, which recently happened with someone...)