# PHP \<ul\>\<li\> MENU PROBLEM

**URL:** <https://forum.kirupa.com/t/php-ul-li-menu-problem/291264>\
**Category:** programming\
**Created:** [June 26, 2009, 10:36pm UTC](https://forum.kirupa.com/t/php-ul-li-menu-problem/291264 "2009-06-26T22:36:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![drummer392](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@drummer392](https://forum.kirupa.com/u/drummer392)\
**Post date:** [June 26, 2009, 10:36pm UTC](https://forum.kirupa.com/t/php-ul-li-menu-problem/291264/1 "2009-06-26T22:36:12Z")

</div>

Hey, I am trying to use this code:

```php

<?php

# 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 "<div id='dhtmlgoodies_slidedown_menu'>";
    echo "<ul><li><a href='#'>{$category[category]}</a><ul>";

    // Get the pages belonging to the category    
    $page_result = mysql_query("SELECT id, title FROM pages WHERE catid={$category[catid]};");
    
    while ($page = mysql_fetch_assoc($page_result))
    {
        echo "<li>{$page[title]}</li>";
    }
	echo "</ul></li></ul></div>";
}
?>

```

and use it with this tutorial using demo 1: [http://www.dhtmlgoodies.com/index.html?whichScript=slidedown\_menu2](http://www.dhtmlgoodies.com/index.html?whichScript=slidedown_menu2)

When I apply the coding with the PHP it doesn’t work, but if I just slap a their menu in their it works fine. Does anyone know what is going on cause I can’t figure this out.
