Go Back   kirupaForum > Development > Server-Side (PHP, SQL, ASP.NET, etc.)

Reply
 
Thread Tools Display Modes
Old 11-22-2009, 01:27 PM   #1
drummer392
Brandon R. Ray
 
drummer392's Avatar
Fla Box Php list-style menu issues

Hey there,

I have a list menu using PHP with 3 levels. Here is how it is laid out:

Category 1
-Link
- Subcategory
- Sublink
and so on.

The problem I am having is getting a "</ul></li>" to show up after each subcategory and sublinks. I can get it to show up once, but if there is more than 1 subcategory, then it needs to show up after every subcategory.

PHP Code:
# Connect to the database 

// Get the categories 
$cat_result mysql_query('SELECT catid, category FROM category;'); 

// Loop through the categories 
    
while ($category mysql_fetch_assoc($cat_result)) 
    { 
    
// Write the category header 
    
echo "<li><a href='javascript:blankfunction()'>{$category[category]}</a><ul>"
    
    
// Get the pages belonging to the category   
    
$getpages mysql_query("SELECT * FROM pages WHERE catid={$category[catid]} AND is_cat=0;");

    while (
$page mysql_fetch_assoc($getpages))
    { 
        echo 
"<li><a href='sidepage.php?id={$page[id]}'>{$page[title]}</a></li>";
    }
    
$getsub mysql_query("SELECT * FROM pages WHERE catid={$category[catid]} AND is_cat=1;");
    
    while (
$sub mysql_fetch_assoc($getsub))
    
    { 
        echo 
"<li><a href='javascript:blankfunction()'>{$sub[title]}</a><ul>";
    }
    
$sid $sub['id'];    
    
$getsubpage mysql_query("SELECT * FROM subpages WHERE sub_id={$sid};");

    while (
$subpages mysql_fetch_assoc($getsubpage))
    { 
        echo 
"<li><a href='javascript:blankfunction()'>{$subpages[title]}</a></li>";
    }    
    
    echo 
"</ul></li>";


Last edited by drummer392; 11-22-2009 at 11:59 PM..
drummer392 is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?
 

Old 11-23-2009, 12:00 AM   #2
drummer392
Brandon R. Ray
 
drummer392's Avatar
I have changed my problem I need help with (the PHP code is different as well):

Quote:
The problem I am having is getting a "</ul></li>" to show up after each subcategory and sublinks. I can get it to show up once, but if there is more than 1 subcategory, then it needs to show up after every subcategory.
drummer392 is offline   Reply With Quote
Old 11-23-2009, 12:01 AM   #3
drummer392
Brandon R. Ray
 
drummer392's Avatar
I have changed my problem I need help with (the PHP code is different as well):

Quote:
The problem I am having is getting a "</ul></li>" to show up after each subcategory and sublinks. I can get it to show up once, but if there is more than 1 subcategory, then it needs to show up after every subcategory.
drummer392 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:33 PM.

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
Flash effects. Art without coding. Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Learn how to advertise on kirupa.com
 

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com