I am complete newbie in programming so my question might sound like an elementary one though i am stuck badly so any help would be much appreciated.
I need to fetch and show subcategories under a category and link them to a page.
Pasting my code snippet below
Code: Select all
$sql = mysql_query("SELECT id , title , nest_under FROM photo_galleries WHERE active = '1'");
while($result = mysql_fetch_assoc($sql)) {
if ($result[nest_under] > 0){
echo '<a href="gallery.php?gid='.$result['id'].'">'.$result['title'].'</a>'. " " . "|" . " ";
}
}
Cat A
Cat B - subcatB_b
Cat C - subcatC_c
so e.g. when i click on Cat C it should only show subcatC_c where as its showing 'subcatB_b' and 'subcatC_c' which is wrong. , lemme know if anyone can help.