Jump to content

DB request for each


Stephan_Mignon

Recommended Posts

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.