PHP <ul><li> MENU PROBLEM

Hey, I am trying to use this code:



<?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

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.