title: Error when trying to run multiple mysqli queries
body: <p>I am currently trying to make a website, and within this website it <em>requires</em> queries that are stacked, or inside each other.</p>
  <p>Here's what I'm working with:</p>
  <pre><code>&lt;?php
      if($getSections = $con-&gt;query(&quot;SELECT * FROM sections&quot;)) {
          if($getSections-&gt;num_rows &gt; 0) {
              while($section = $getSections-&gt;fetch_assoc()) {
                  $sectionID = $section['sectionID'];
                  echo '&lt;br&gt;' .$section['sectionID']. ' ' .$section['sectionName'];
                  if($getItems = $con-&gt;query(&quot;SELECT * FROM items WHERE sectionID=$sectionID&quot;)) {
                      if($getItems-&gt;num_rows &gt; 0) {
                          while($item = $getItems-&gt;fetch_assoc()) {
                              echo '&lt;br&gt;' .$item['itemID']. ' ' .$item['itemName'] ' ' .$item['sectionID'];
                          };
                      } else {
                          echo '&lt;p class=&quot;alert&quot;&gt;No Items&lt;/p&gt;';
                      };
                  };
                  $getItems-&gt;close();
              };
          } else {
              echo '&lt;p class=&quot;alert&quot;&gt;No Sections&lt;/p&gt;';
          };
      };
      $getSections-&gt;close();
  ?&gt;
  </code></pre>
  <p>When I run this I get an error:</p>
  <blockquote>
  <p>500 - Internal server error.</p>
  <p>There is a problem with the resource you are looking for, and it cannot be displayed.</p>
  </blockquote>
  <p>, but when I run:</p>
  <pre><code>&lt;?php
      if($getSections = $con-&gt;query(&quot;SELECT * FROM sections&quot;)) {
          if($getSections-&gt;num_rows &gt; 0) {
              while($section = $getSections-&gt;fetch_assoc()) {
                  $sectionID = $section['sectionID'];
                  echo '&lt;br&gt;' .$section['sectionID']. ' ' .$section['sectionName'];
  
              };
          } else {
              echo '&lt;p class=&quot;alert&quot;&gt;No Sections&lt;/p&gt;';
          };
      };
      $getSections-&gt;close();
  ?&gt;
  </code></pre>
  <p>I don't get an error, am I doing something wrong? or is there something wrong with my web server?</p>