0

Currently I've a database table call category:
Table attribute: id,parent_id,name

How can I make it display in the following structure?

<li class="dropdown level-0"><a href="#">electronics<img src="images/dropdown-arrow.png" alt="" /></a>
                    <ul>
                        <li class="level-1"><a href="#">Televisions</a>
                            <div class="level-1-div clearfix">
                                <ul>
                                    <li class="level-2"><a href="catalog.html">Projectors</a></li>
                                    <li class="level-2 last-level-2"><a href="catalog.html">DVD Players</a></li>
                                </ul>                                

                                <div class="productImageDiv">
                                    <a href="catalog.html"><img src="images/product-image2.png" alt="" /></a>
                                </div>
                            </div>
                        </li>
                        </ul>
                        </li>
3
Contributors
4
Replies
15
Views
4 Years
Discussion Span
Last Post by devianleong
0

The most important component here is to the get your SQL query correct. Once you have that, its a matter of creating the logic to echo the structure you are looking for, plugging in the variables in the correct location within your <li/> elements.

0

Please help me. This is my query

SELECT * FROM category 

My table columns is : id,parent_id,name

Please help me structure a php code to suit the html code above . Please

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.