title: PHP/MYSQL: showing data out of 2 tables
body: <p>This is my first question and I tried to make it clear enough so you guys/girls can understand it. If I am missing something or doing something wrong please let me know! Its my first question.</p>
  
  <p><strong>What I want:</strong></p>
  
  <p>I want it to show the <code>voornaam</code> out of the table <code>Klanten</code> to show next to the other ones out of the table <code>onderwerpen</code>. For example I want the <code>voornaam</code> to show next to the <code>henk</code> and <code>koken</code>. So I expect it to show the data out 2 different tablesin the block you can see on the pic.</p>
  
  <p>I tried using a foreach loop with 2 conditions but that it not possible. So I was wondering what the solution in this case needs to be. Because It works with 1 condition in the <code>foreach</code> but it is not possible to do this with 2 conditions.</p>
  
  <p><strong>What I have tried:</strong></p>
  
  <pre><code>&lt;div class="box box-primary"&gt;
      &lt;div class="box-header with-border"&gt;
        &lt;h3 class="box-title"&gt;Onderwerpen&lt;/h3&gt;
      &lt;/div&gt;&lt;!-- /.box-header --&gt;          
  
      &lt;div class="box-body"&gt;
  &lt;?php
       $onderrwerp = $app-&gt;get_onderwerpen();
       $klantten = $app-&gt;get_klanten();
       foreach($onderrwerp as $onderwerp and $klantten as $klant){
         echo '&lt;div class="well well-sm"&gt;';
         echo '&lt;a href="https://tom.lbmedia.nl/reactie"&gt;' . $onderwerp['voornaam'].'&lt;/a&gt;';
         echo '&lt;h3&gt;'.$onderwerp['naam'].'&lt;/h3&gt;&lt;br&gt;'; 
         echo '&lt;a href="https://tom.lbmedia.nl/reactie"&gt;'  .$onderwerp['naam'].'&lt;/a&gt;';
         echo '&lt;/div&gt;';
      }
      ?&gt;
  </code></pre>
  
  <p><strong>The code:</strong></p>
  
  <pre><code>&lt;div class="box box-primary"&gt;
      &lt;div class="box-header with-border"&gt;
        &lt;h3 class="box-title"&gt;Onderwerpen&lt;/h3&gt;
      &lt;/div&gt;&lt;!-- /.box-header --&gt;                 
  &lt;div class="box-body"&gt;
  &lt;?php
   $onderrwerp = $app-&gt;get_onderwerpen();
   foreach($onderrwerp as $onderwerp){
     echo '&lt;div class="well well-sm"&gt;';
     echo '&lt;h3&gt;'.$onderwerp['naam'].'&lt;/h3&gt;&lt;br&gt;'; 
     echo '&lt;a href="https://tom.lbmedia.nl/reactie"&gt;'  .$onderwerp['naam'].'&lt;/a&gt;';
     echo '&lt;/div&gt;';
  }
  ?&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/H5Kgu.png" alt="How it looks like with this code"></p>
  
  <p><img src="https://i.stack.imgur.com/Y4BSb.png" alt="Database 1."></p>
  
  <p><img src="https://i.stack.imgur.com/ojRHw.png" alt="Database 2."></p>
  
  <p><strong>The functions:</strong></p>
  
  <pre><code>public function get_onderwerpen(){
          $getOnderwerp = $this-&gt;database-&gt;query("SELECT * FROM onderwerpen ORDER BY id ASC");
          $onderwerpen = $this-&gt;database-&gt;resultset();
  
          return $onderwerpen;
  
     }
  public function get_klanten(){
          $getKlant = $this-&gt;database-&gt;query("SELECT * FROM klanten ORDER BY punten DESC");
          $klanten = $this-&gt;database-&gt;resultset();
  
          return $klanten;
  
      }
  </code></pre>