Waleed-KH Posted April 19, 2013 Share Posted April 19, 2013 Hey guys If i have a database like this How can I extract items so that after each item is extracted sub-items So the output will be <ul> <li> <span>Item 1</span> </li> <li> <span>Item 2</span> <ul> <li> <span>Item 2-1</span> <ul> <li> <span>Item 2-1-1</span> </li> <li> <span>Item 2-1-2</span> </li> </ul> </li> <li> <span>Item 2-2</span> <ul> <li> <span>Item 2-2-1</span> <ul> <li> <span>Item 2-2-1-1</span> </li> <li> <span>Item 2-2-1-2</span> </li> </ul> </li> </ul> </li> </ul> </li> <li> <span>Item 3</span> <ul> <li> <span>Item 3-1</span> <ul> <li> <span>Item 3-1-1</span> </li> </ul> </li> <li> <span>Item 3-2</span> </li> <li> <span>Item 3-3</span> </li> </ul> </li> </ul> Please answer and thank you Quote Link to comment https://forums.phpfreaks.com/topic/277142-extract-rows-from-database-in-a-particular-order/ Share on other sites More sharing options...
computermax2328 Posted April 19, 2013 Share Posted April 19, 2013 Can you reattach the photo of your database? The basic idea is to query the database, loop through the results and echo out the query results inside out the loop along with the HTML you want to output. Quote Link to comment https://forums.phpfreaks.com/topic/277142-extract-rows-from-database-in-a-particular-order/#findComment-1425779 Share on other sites More sharing options...
Waleed-KH Posted April 19, 2013 Author Share Posted April 19, 2013 database : Quote Link to comment https://forums.phpfreaks.com/topic/277142-extract-rows-from-database-in-a-particular-order/#findComment-1425784 Share on other sites More sharing options...
jazzman1 Posted April 19, 2013 Share Posted April 19, 2013 Only one table - check this out. You can google it - how to display hierarchy in php. Quote Link to comment https://forums.phpfreaks.com/topic/277142-extract-rows-from-database-in-a-particular-order/#findComment-1425785 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.