This is the exact same menu produced by this sample with the only difference that this one uses the new dmbAPI_parseArray function, which, as you can see, can considerably simplify the process of creating dynamic menus. Actually, if the items in the database would have been better organized, the code would have been even simpler...
(1/May/2008)

<script language="javascript">
var si;

dmbAPI_Init();

<?
    mysql_connect("localhost","root","abc12345");
    mysql_select_db("ipb");

    runQuery("select * from ipbf_xfx_forums where parent_id = -1 order by position;");
    runQuery("select * from ipbf_xfx_forums where parent_id != -1 order by id desc;");


    function runQuery($query) {
        $c = mysql_query($query);
        $tc = mysql_num_rows($c);
        $ci = 0;
        while($ci < $tc) {
            $id = mysql_result($c, $ci, "id");
            $pid = mysql_result($c, $ci, "parent_id");
            $caption = mysql_result($c, $ci, "name");
            $url = "/uboards/forums/index.htm?showforum=".$id;
            if($pid == -1) $pid = 0;

            echo "si = dmbAPI_parseArray($id, $pid, '$caption', '$url', '_blank');\n";
            if($pid != 0 && hasSubItems($id)) {
                echo " dmbAPI_setImageRightNormal(si, '/menu/images/arrow_black.gif', 12, 11);\n";
                echo " dmbAPI_setImageRightOver(si, '/menu/images/arrow.gif', 12, 11);\n";
            }

            $ci++;
        }
    }
   
   
mysql_close();

    function hasSubItems($cid) {
        $sc = mysql_query("select id from ipbf_xfx_forums where parent_id=$cid;");
        if($sc) return (mysql_num_rows($sc)>0);
        return false;
    }

?>
</script>