title: Recursive function to generate breadcrumbs
body: <pre><code>function createPath($id, $category_tbl, $path) {
  
      $s = "SELECT * FROM ".$category_tbl." WHERE ID = $id";
      $r = mysql_query($s);
      $row = mysql_fetch_array($r);
  
      if($row['PARENT_ID'] == 0) {
          $path .=$row['TITLE'].'-';
      }
      else {
          $path .='-'.$row['TITLE'];
          createPath($row['PARENT_ID'],$category_tbl, $path);
  
      }
      return $path;
  }
  </code></pre>
  
  <p>It is a recursive function that must generate breadcrumbs. I cannot get it to work properly, it only returns the last TITLE.</p>
  
  <p>the sql table is something like ID, TITLE, PARENT_ID
  a PARENT_ID = 0 means the category has no parent,
  for any other PARENT_ID, go to that ID, get it's title and add it to the <code>$path</code> variable</p>
  
  <p>I need help to make this work. Alternatives are also welcomed.</p>