Stephan_Mignon Posted September 14, 2015 Share Posted September 14, 2015 Hello Everyone.. I am limited in php but can do basic stuff . Stocked with foreach ( I am not familiar with ) any idea on how to achieve the following : I have right now a request to display all actives pages : <ul><?$res=mysql_query("SELECT * FROM pages WHERE active='Yes' ORDER BY ordre ASC ") ;while ($row=mysql_fetch_array($res_all)) {echo "<li>page number & section</li>";?></ul> I get results like : - page 1 - A- page 2 - A- page 3 - B- page 4 - B- page 5 - A- page 6 - A- page 7 - A- page 8 - B- page 9 - B- page 10 - A Some of pages I would like to display section B under an other listing that woud like this : - page 1 - A - page 2 - A - page 3 - B - page 4 -B - page 8 - B - page 9 - B - page 5 - A - page 6 - A - page 7 - A The B section ( set a sub_section ) in DB should be creating a new UL listing inside the menu Should I use foreach in the request ? I would really appreciate any help Thanks Stef Quote Link to comment Share on other sites More sharing options...
Barand Posted September 14, 2015 Share Posted September 14, 2015 We have no knowledge of the structure of your data. Is there anything in the data to indicate that 4B, 8B and 9B are subsections of 3B, as in you second list above? Quote Link to comment 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.