This is the way I need to display my data:
Electronics main heading
Mobile category
Galaxy s sub category
I'm using three tables: mainheading, category and subcategory. All have a foreign key to each.
I want to know which would be efficient method to display this kind of data.I was reading about these methods: Adjacency list, Path enumeration, Nested sets, Closure table.
Can you also point out a good example for implementing this?
After join,this is how my table looks like
1. Electronics mobile Galaxy s
$x = "";
$z = "";
while()
{
if($x != $mainheading)
{
$y = $row['mainheading'];
$x = $y;
}
if($y != $category)
{
$s = $row['category'];
$z = $s;
}
}
DB Structure
Main Heading sno primary key mainheading
Category
sno primartkey msno foriegn key category
Sub Item
sno primary key csno foriegn key subitem
I used join on three tables to form above
Electronics mobile Galaxy s
HTML
<div> Main Heading <div> </div>
</div>
<div><second opens>
<div><third close>
<h3> Category</h3>
<div>
<p>Sub item</p> </div>
</div><third close?
</div><second close>