title: JOIN in the same table and FOREACH with IMPLODE to get menu
body: <p><strong>Table:</strong> <code>categories</code></p>
  
  <pre><code>╔═════════════╦═══════════════════╦═════════════════╗
  ║ id_category ║ category_name     ║ category_father ║
  ╠═════════════╬═══════════════════╬═════════════════╣
  ║  1          ║ Home              ║   0             ║
  ║  2          ║ Category_1        ║   1             ║
  ║  3          ║ Category_2        ║   1             ║
  ║  4          ║ Category_3        ║   1             ║
  ║  5          ║ Category_4        ║   1             ║
  ║  6          ║ Category_5        ║   1             ║
  ║  7          ║ Sub_Category_1    ║   2             ║
  ║  8          ║ Sub_Category_2    ║   2             ║
  ║  9          ║ Sub_Category_3    ║   2             ║
  ║  10         ║ Sub_Category_4    ║   2             ║
  ║  11         ║ Sub_Category_5    ║   3             ║
  ║  12         ║ Sub_Category_6    ║   3             ║
  ║  13         ║ Sub_Category_7    ║   3             ║
  ║  14         ║ Sub_Category_8    ║   3             ║
  ║  15         ║ Sub_Category_9    ║   3             ║
  ╚═════════════╩═══════════════════╩═════════════════╝
  </code></pre>
  
  <p>I am using <code>meekro.class</code> to consult my database, right now I'm building the menu of my application, but I need to do <code>JOIN</code> to the same <code>table</code> to show the <code>category_name</code> instead of the <code>id</code> of <code>category_father</code> and I can not.</p>
  
  <p>I also need to show in list form the main categories and below the subcategories. I intend to use only one level of <code>sub categories</code> so this table structure should work.</p>
  
  <p><strong>This is my query:</strong></p>
  
  <pre><code>$querycategories = DB::query("SELECT * FROM categories");
  foreach ($querycategories as $row) {
      echo "&lt;b&gt;" . $row['category_name'] . "&lt;/b&gt;";
      echo "&lt;ul&gt;";
          echo "&lt;li&gt;" . $row['category_father'] . "&lt;/li&gt;";
      echo "&lt;/ul&gt;";
  }
  </code></pre>
  
  <p>Of course, with this consultation, I get a disaster, that's why I come to you to get help!</p>
  
  <p><strong>This is what I hope to obtain:</strong></p>
  
  <p><strong>Category_1</strong></p>
  
  <ul>
  <li>Sub_Category_1</li>
  <li>Sub_Category_2</li>
  <li>Sub_Category_3</li>
  <li>Sub_Category_4</li>
  </ul>
  
  <p><strong>Category_2</strong></p>
  
  <ul>
  <li>Sub_Category_5</li>
  <li>Sub_Category_6</li>
  <li>Sub_Category_7</li>
  <li>Sub_Category_8</li>
  <li>Sub_Category_9</li>
  </ul>
  
  <p><strong>Category_3</strong></p>
  
  <p><strong>Category_4</strong></p>
  
  <p><strong>Category_5</strong></p>
  
  <p>I hope you can help me, it takes almost 1 hour to write the question, please, take 5 minutes of your day to help me, thanks in advance!</p>