I have main categories and sub categories.
at cat.php?id=1 page; (id=1 is main category)
I want to show also subcategories content.
My categories table:
id - sub - title
(if sub=0 it means this is main category. if not it's sub category)
My current query is like that;
<?php
$id = $_GET['id'];
$data = mysql_query("select * from content where category=".$id." order by id desc");
while($r=mysql_fetch_array($data))
{
echo "$r[id] - $r[title]";
}
?>
Shows only main category content, but not sub categories content. (at cat.php?id=1)
*
I think I must connect the categories table again to get sub categories' ID. ???
Surely, I need a new query. I need to get sub=".$id."
and list here in the same page.
I stuck.
where parentCategory=".$id."
– Micaiah Wallacesub=".$id."
i need to add this. But I don't keepsub
field in content table. So, I need to also connect categories table. But couldn't find a way how? – Rough