title: php recursive breadcrumb from MySQL with category names
body: <p>Here is my code:</p>
  
  <pre><code>function printBreadCrumb($id,$level=0) {
  
      $levelNames=array('Year','Model','Serie','Maker');
      $query = "SELECT * FROM category  WHERE del=0 AND id=".$id." LIMIT 0,1";
      $res = mysql_query($query) or die($query);
      while ($row = mysql_fetch_array($res)) {
  
        $link = "&lt;a href=\"index.php?parent_id=".$row['parent_id'].
                "\"&gt;".$levelNames[$level].":".$row['name']."&lt;/a&gt;";
  
        $bc .= $level==0 ? $link : $link . ' &gt; '  ;
        $parent_id = $row['parent_id'];
  
        printBreadCrumb($parent_id,$level+1);
      }
      echo $bc."";   
    }
  </code></pre>
  
  <p>The function works fine and I can see the correct category names.<br>
  What I want: show into which levelName belongs the item.</p>
  
  <p>eg.: Maker:BMW > Serie:3 > Model:320 > Year:2009</p>
  
  <p>Now my code only works in the deepest cateyory [Year]. If I go up one level I get this:</p>
  
  <p>Serie:BMW > Model:3 > Year:320</p>