I have a category table
cat_id, cat_name, parent_id, cat_slug
and I have article table as follow
art_id, cat_id, art_title, art_content, author_id .....
and my users table as
user_id, username, pw, .....
so with these data, I want to display all articles which are listed under sub category
for example:
url of main category is: mydomain.com/cat/business url of sub category is: mydomian.com/cat/business/advertising
so when people visit the main category, then it should display the subcategories listed articles on main category even though the cat_id is not mentioned as main category. I want to list out all sub categories of business's subcategories articles on business category page.
what is the query, i should try to achieve this
help will be appreciated. thanks
parent_id
there, which, I assume, will benull
for top level categories and contain the parent category id otherwise. - Aleks G$query = SELECT a.art_whatever FROM articles a, categories c WHERE c.cat_id = a.cat_id AND c.parent_id = '$cat'";
- DaOgre