I have database table that has these values:
ID and SUB
-- --
1 0
2 0
3 0
4 0
5 0
Now from php/mysql I'm trying to do this: if I put for example the value of ID to SUB, to create a <ul><li></li><ul>
level. For example:
if ID=5
has SUB=1
, then I should have
<ul>
<li> 1
<ul><li> 5 </li></ul>
</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
If, for example, ID=1
has SUB=2
, then I should have:
<ul>
<li> 2
<ul><li> 1
<ul><li>5</ul>
</li></ul>
<li>3</li>
<li>4</li>
</ul>
</div>