I want to display menu from mysql database. This is what I tried so far and don't know what is the error for. I appreciate any help . I posted the table that I want to display and the error that I got
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\wamp\www\second _try\eCRA.php on line 18
<?php
    function display_menu($parent, $level) {
        $query=mysql_query("SELECT n.id, n.menu_name, n.link, d.count FROM 'menu' n 
        LEFT OUTER  JOIN(SELECT parent, COUNT (*) AS count FROM 'menu' GROUP BY
        parent) d ON  n.id=d.parent  W HERE n.parent=".$parent);
        echo"<ul>";
        while($row = mysql_fetch_assoc($query)) {
            if($row['count']>0) {
                echo"<li><a href='" .$row['link']. "'>". $row['menu_name'] ."</a>";
                display_menu($row['id'], $level + 1);
                echo"</li>";
            }//f
            elseif($row['count']==0) { 
                echo"<li><a href='". $row['link'] ."'>". $row['menu_name'] ."</a></li>";
            }else; 
        }//w
        echo"</ul>";
    }
    display_menu(0,2);
?>
![error][1]
![Table][2]