title: Foreach MySQL Join by Category
body: <p>**How to foreach from join database for show Foods by its Category.
  Thank you. **</p>
  <p>How to select from database with join to foreach the results by category.</p>
  <pre><code>mysql&gt; SELECT * FROM categories;
  +-----+-----------------+
  | id  | categories      |
  +-----+-----------------+
  | 1   | Oven            |
  | 2   | Pizza           |
  | 3   | Salad           |
  | 4   | Starter         |
  | 5   | Coffee          |
  | 6   | Softdrinks      |
  +-----+-----------------+
  
  mysql&gt; SELECT * FROM foods;
  +------+----------------------+--------+--------------+
  | id   | name                 | price  | category_id  | 
  |+-----+----------------------+--------+--------------+
  | 1816 | Acini                | 15     | 1            |
  | 1817 | Wedding Soup         | 11     | 1            |
  | 1818 | Pasta Campanelle     | 12     | 4            |
  | 1819 | Chicken Noodle Soup  | 12     | 6            |
  | 1820 | Pizza Valtellina     | 12     | 5            |
  | 1821 | Cedar Planked Salmon | 11     | 3            |
  | 1822 | Italian Sausage Soup | 12     | 3            |
  | 1823 | Pasta Pappardelle    | 10     | 1            |
  +------+----------------------+--------+--------------+
  </code></pre>
  <p>Please how the MySQL code for join the tables.</p>
  <p>And the results should like below</p>
  <pre><code>$results = [
      'Oven' =&gt; [
          ['name' =&gt; 'Acini', 'price' =&gt; '15'],
          ['name' =&gt; 'Wedding Soup', 'price' =&gt; '11'],
          ['name' =&gt; 'Pasta Pappardelle', 'price' =&gt; '10']
      ],
      'Starter' =&gt; [
          ['name' =&gt; 'Pasta Campanelle', 'price' =&gt; '12']
      ],
      'Softdrinks' =&gt; [
          ['name' =&gt; 'Chicken Noodle Soup', 'price' =&gt; '12']
      ],
      'Coffee' =&gt; [
          ['name' =&gt; 'Pizza Valtellina', 'price' =&gt; '12']
      ],
      'Salad' =&gt; [
          ['name' =&gt; 'Cedar Planked Salmon', 'price' =&gt; '11'],
          ['name' =&gt; 'Italian Sausage Soup', 'price' =&gt; '12']
      ]
  ];
  </code></pre>
  <p>Please help.
  Thank you in advanced.</p>